ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Help: How to use weblog entries in a PHP Include file

September 14, 2007 2:55pm

Subscribe [2]
  • #1 / Sep 14, 2007 2:55pm

    otane

    5 posts

    Do I need to do anything special to use an include file which contains weblog entries?

    Here’s my draft page:

    Linky

    You can see the section “Latest Forum Posts” where the include fails.

    Here’s the related code from the include:

    <div id="sidebar_subcat">
      <h1>Latest Forum Posts</h1>
        <ul>
            {exp:weblog:entries weblog="membership_info"}                   
            <li><a href="http://{url_title_path=membership_info}">{title}</a></li>
            {/exp:weblog:entries}
        </ul>
    </div>

    Thanks in advance for your feedback!

  • #2 / Sep 14, 2007 4:55pm

    grantmx

    1439 posts

    Did you turn on PHP for the template your include is sitting in?

  • #3 / Sep 14, 2007 6:31pm

    otane

    5 posts

    Thanks for the reply.  Yes. Where I don’t use an include file, the weblog entries are displayed correctly. 

    <?php session_start(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>BudoMembership.com - Martial Arts, MMA, Brazilian Jiu Jitsu</title>
    <link rel='stylesheet' type='text/css' media='all' href='{stylesheet=budo_membership/site}' />
    </head>
    
    <body>
    <div id="Container">
        <?php include("http://www.budomembership.com/includes/header.inc.php"); ?>
        <?php include("http://www.budomembership.com/includes/menu.inc.php"); ?>
        <?php include("http://www.budomembership.com/includes/h_banner.inc.php"); ?>
        <div id="wrapper">
        <?php include("http://www.budomembership.com/includes/h_sidebar.inc.php"); ?>    
        <div id="h_centerbar">
            <h1>News</h1>
            <div class="news">
                {exp:weblog:entries weblog="budo_news"} 
                <h2 class="c_bar_news_h2"> {title}  </h2>
                             {summary} 
                             <a href="http://{permalink=">more</a> 
                    {/exp:weblog:entries} 
            </div>
        </div>
        <div id="h_sidebar2">
          <h1>Videos</h1>
          <div id="videos">
                {exp:weblog:entries weblog="budo_sample_videos"} 
        <div>            
            <h2> {title}  </h2>
    <p>            by {video_author} <br />
                » <a href="http://{permalink=">view</a><br />
        </div><br />
                      {/exp:weblog:entries} <br />
          </div><br />
        </div></p>
    
    <p> </div>      <br />
        <?php include("http://www.budomembership.com/includes/footer.inc.php"); ?>  <br />
    </div></p>
    
    <p></body><br />
    </html>

  • #4 / Sep 14, 2007 7:07pm

    grantmx

    1439 posts

    I think my question should have been, is your include sitting in an EE template?  Because it looks like its not.

    Instead of putting that include with your external PHP file, place it in a template and embed it like this:

    {embed="template_group/template"}

    I believe its how EE parses the code if its not within the EE system.

  • #5 / Sep 15, 2007 9:01am

    otane

    5 posts

    That did it!  Thank you very much!

  • #6 / Sep 15, 2007 9:16am

    grantmx

    1439 posts

    Cool beans man.  Glad it worked.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases