Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems including WordPress loop
#1
I'm trying to insert the few lines of code required to pull some WordPress onto my site. I'm starting out by copying the code included at http://codex.wordpress.org/Integrating_W...ur_Website and will flesh it out later. Trouble is, when I call up the page with this code, the WordPress content doesn't display, nor does anything that comes after this code snippet. The WordPress works fine on a blank file that I made but doesn't work within GetSimple. Any ideas what could be wrong?
Reply
#2
captadam Wrote:I'm trying to insert the few lines of code required to pull some WordPress onto my site. I'm starting out by copying the code included at http://codex.wordpress.org/Integrating_W...ur_Website and will flesh it out later. Trouble is, when I call up the page with this code, the WordPress content doesn't display, nor does anything that comes after this code snippet. The WordPress works fine on a blank file that I made but doesn't work within GetSimple. Any ideas what could be wrong?

Welcome here!

As we have no crystal balls nor witchcraft, we need more information.
It is better for us that you give us the code which you included instead of first reading long articles and guessing what you did ;=)

so:

please tell us:

- the url of your site
- which code did you include
- the version of GetSimple
- did you include it into the page content, a component or a template?

I am sure we will find a solution,

cheers, Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#3
do you define absolute or relative paths to files when calling require() function ?
There's an annotation about base href, but I'd just stay with absolute paths.
Addons: blue business theme, Online Visitors, Notepad
Reply
#4
Thanks for the quick response! And sorry for not including much detail. I was hoping maybe somebody would think, "Oh, right, WordPress! I know the problem exactly!"

Here's the site with the problem: http://www.gilsonforcouncil.com/test/
Don't judge the site harshly--I am currently bumbling through GetSimple to move my stopgap site off WordPress.


If you look at the source, you'll see that it stops right before the following code:

<?php
define('WP_USE_THEMES', false);
require('........./wp-blog-header.php');
query_posts('showposts=10');
?>

<?php
$posts = get_posts('numberposts=10&order=ASC&orderby=post_title');
foreach ($posts as $post) : start_wp(); ?>
<?php the_date(); echo "<br />"; ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php
endforeach;
?>

That EXACT code (inside an otherwise blank HTML document) produces the following: http://www.gilsonforcouncil.com/test/test.php

I included the code into a page template for the home page. I realize that's not the best way to do it, but I couldn't quite figure out how to put it into either a page or a component. I'm using GetSimple version 2.03.1.

Thanks again!
Reply
#5
Can you enable the debug mode in the gsconfig.php maybe we get some response from the system.

cheers
Reply
#6
valdiating your page brings the answer:

Quote:got the following unexpected response when trying to retrieve <http://www.gilsonforcouncil.com/test/>:

500 Internal Server Error

is the wordpress-installation really at your domain?
or are you trying to read content from another domain? There can be some server restrictions for doing that ...

and

Quote:require('........./wp-blog-header.php');
what is replaced by these points?
or do you want to use relative paths without slashes?
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#7
Connie Wrote:valdiating your page brings the answer:


Quote:require('........./wp-blog-header.php');
what is replaced by these points?
or do you want to use relative paths without slashes?

The absolute path (rather than the domain) to the file is in the code, and I replaced it above for purposes of posting here. The exact code, with the correct path to the file, is located here (http://www.gilsonforcouncil.com/test/test.php) and gives me the result I want. But that's not within the CMS.

Thanks for sticking with this.
Reply
#8
did you enable the DEBUG? Is there any information from that?

you could test with the Plugin EXEC-PHP http://get-simple.info/extend/plugin/exec-php/17/ and a template

I would suggest to include that code into a template (copy template.php in your theme-directory to wp.php)

when a page which uses that template is opened, the path starts from the root directory of GS, in your case /test

include the code there exactly like in the test.php

Unfortunately I have no WP-installation in the same domain as GetSimple so I cannot test myself
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#9
Here's what I've tried:

-Installed a WordPress in a subfolder of /test/
-Upgraded GetSimple to version 3.0
-Installed exec-php plugin
-Added the call to the WordPress loop to a component and included it within a template that is used by only the Home page
-Changed the test.php (gilsonforcouncil.com/test/test.php) code to point to the WordPress installation in the /test/ subfolder and copied it exactly into the GetSimple CMS component

And, after all that, the results are the same. Something in the PHP code is causing the parsing to stop immediately and return an incomplete file, but only in the CMS. When that code is pasted into an otherwise empty file, it parses okay.
Reply
#10
Okay, I figured out how to enable debug and have this error:

Fatal error: Cannot redeclare add_filter() (previously declared in .../gilsonforcouncil.com/test/admin/inc/plugin_functions.php:272) in .../gilsonforcouncil.com/test/wp/wp-includes/plugin.php on line 72
Reply
#11
I also got an incomplete page when including the way you did

so I included it into an iframe

http://www.urbanistan.de/getsimple/wp-in-gs

that is a first start, I think

the code:
Code:
<body id="<?php get_page_slug(); ?>" >
<!-- include the menu  template -->
<?php include('inc_menu.php'); ?>
<div style="clear:both;"></div>


<iframe src="./wp/index.php" width="90%" height="1200" name="WP_in_GS" scrolling="auto">
  <p>This here needs a browser which can read iframes</p>
</iframe>
</div>

<!-- include the footer template -->
<?php include('inc_footer.php'); ?>

But did you really search the web for tutorials how to include? why do you stick to the one info at wordpress.org which is not working?
There are more ..

here for example is a very detailled tutorial and it needs a little bit more than just 4 lines of code ;=(

http://www.burnseo.com/blog/2009/10/inte...-tutorial/

and here as well: http://idratherbewriting.com/2008/10/23/...g-website/


good luck, Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply




Users browsing this thread: 1 Guest(s)