Results 1 to 6 of 6

Thread: Include a Div into website

  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Include a Div into website

    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,

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:

    PHP Code:
    echo '$whatever = ' $whatever
    or:

    PHP Code:
    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Oct 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.
    Code:
     <!-- 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

    Code:
    <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
    Last edited by jscheuer1; 10-21-2010 at 04:15 PM. Reason: fix broken link

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Oct 2010
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Xyrillion View Post
    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 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.

  6. #6
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    You could use jquery to do this:
    Code:
    <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.
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •