View Full Version : Include a Div into website
Xyrillion
10-21-2010, 12:48 PM
Dear,
After spending serveral hours / days on the web I'm still unable to come up with the answer.
I'll skip all rest of the introduction talk and go right to it.
I need the div (id="content") from http://www.lightningleiden.nl/wordpress/index.php copied/included into the div (id="nieuws") from http://www.lightningleiden.nl/bestuur.php
The 'content div' is set up by server side php scripting and and thus the usual php include doesn't work.
The only time when the 'content div' is complete is when I look at the source of the page in the browser.
Thanks in advance,
jscheuer1
10-21-2010, 01:48 PM
Since it's all PHP (include and included to page), the PHP script on the include must complete after it's included. Since the include is on a different path (/wordpress/) than the included page (/), paths on the include should be absolute. Or if that doesn't work (depends upon the PHP settings), relative to the included to page.
Any header functions (perhaps others) on the include may have to be on the included to page.
The only way I can think of to troubleshoot all this is to have the include temporarily echo or print_r() at key points the value of its variables, etc. to see if they are still being resolved properly once it is included, ex:
echo '$whatever = ' . $whatever;
or:
print_r($whatever);
To that end some data not currently assigned to variables on the include might need to be.
If you want specific help, we would need to see all of the (or at least the problem) PHP code involved.
Xyrillion
10-21-2010, 02:25 PM
There isn't really that much php code involved i think.
This is where the div should be included.
The div id="nieuws" should be the div with the information from the other page.
<!-- Begin Content Column -->
<div id="content" >
<h2 class="center">Nieuws Van Het Bestuur</h2>
<br />
<p>Op deze pagina kunt U nieuwsberichten van het bestuur vinden.</p>
<p>Deze worden direct door iemand van het bestuur op deze pagina gezet.</p>
<br />
<div id="nieuws">
<p>Some include thingy here from the other page should come here.</p>
</div>
</div>
<!-- End Content Column -->
This is the which need to get implemented in the code stated above.
The full source code can be best found when you look at the source code with your browser.
It is a un-edited version from Wordpress.
You can find their complete coding here (http://wordpress.org/download/)
<div id="container">
<div id="content" role="main">
<div id="post-1" class="post-1 post type-post hentry category-geen-categorie">
<h2 class="entry-title"><a href="http://www.lightningleiden.nl/wordpress/?p=1" title="Permalink naar Hallo wereld!" rel="bookmark">Hallo wereld!</a></h2>
<div class="entry-meta">
<span class="meta-prep meta-prep-author">Geplaatst op</span> <a href="http://www.lightningleiden.nl/wordpress/?p=1" title="10:32" rel="bookmark"><span class="entry-date">21 oktober 2010</span></a> <span class="meta-sep">door</span> <span class="author vcard"><a class="url fn n" href="http://www.lightningleiden.nl/wordpress/?author=1" title="Bekijk alle berichten van webmaster">webmaster</a></span>
</div><!-- .entry-meta -->
<div class="entry-content">
<p>Welkom bij WordPress. Dit is een eerste voorbeeldbericht. Je kunt het bewerken of verwijderen en starten met bloggen!</p>
</div><!-- .entry-content -->
<div class="entry-utility">
<span class="cat-links">
<span class="entry-utility-prep entry-utility-prep-cat-links">Gepost in</span> <a href="http://www.lightningleiden.nl/wordpress/?cat=1" title="Alle berichten bekijken in Geen categorie" rel="category">Geen categorie</a> </span>
<span class="meta-sep">|</span>
<span class="comments-link"><a href="http://www.lightningleiden.nl/wordpress/?p=1#respond" title="Reactie op Hallo wereld!">Plaats een reactie</a></span>
</div><!-- .entry-utility -->
</div><!-- #post-## -->
</div><!-- #content -->
</div><!-- #container -->
Hope this helps
jscheuer1
10-21-2010, 04:17 PM
I see no PHP code in your post. I need the PHP code for at least both pages, the include and the included to pages. I don't have time to sift through the entire worpress package you linked to.
Dear,
After spending serveral hours / days on the web I'm still unable to come up with the answer.
I'll skip all rest of the introduction talk and go right to it.
I need the div (id="content") from http://www.lightningleiden.nl/wordpress/index.php copied/included into the div (id="nieuws") from http://www.lightningleiden.nl/bestuur.php
The 'content div' is set up by server side php scripting and and thus the usual php include doesn't work.
The only time when the 'content div' is complete is when I look at the source of the page in the browser.
Thanks in advance,
It appears that what you're trying to do is take content from a WordPress-based site and insert it into a non-WordPress site. WordPress uses a custom loop to find and display content from the WordPress database and dynamically code it into HTML using PHP.
I would recommend reading through the WordPress Codex (http://codex.wordpress.org/Main_Page) to understand how WordPress is designed to work. I would also recommend running a WordPress installation on your server if you want to incorporate information from WordPress.
fileserverdirect
10-23-2010, 02:32 AM
You could use jquery to do this:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
<script type="text/javascript">
$("nieuws").load("/wordpress/index.php#content");
</script>
</body>
but this does not run server-side and would require the user to have javascript.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.