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.

Attempting to display an entry on a page based on the link clicked. (php variable)

November 20, 2013 9:43pm

Subscribe [0]
  • #1 / Nov 20, 2013 9:43pm

    Victor Paredes

    7 posts

    Hey all! I’ve been struggling with this for a while and I was wondering if someone could give me a pointer? I am working on the news section of my site and I’m attempting to link from a news listing to a specific article page that is dynamically created based on a PHP variable that I’m passing through the linked URL (e.g. http://www.mysite.com/index.php?article=article-name ).

    What I currently have doesn’t display anything at all! Here it is:

    {exp:channel:entries channel="news_updates" url_title="<?php echo $_GET['article']; ?>"}
    
                 <div class="news_date">{entry_date format="%F %j, %Y"} </div>
                    <div class="news_title">{title}</div>
                    <div class="news_summary">{article_summary}</div>
    
    {/exp:channel:entries}

    This seems rather strange since all entries display properly if I exclude the ‘url_title=’ selector on the first line:
    <pre><code>{exp:channel:entries channel="news_updates"}</code></pre>

    I’ve looked through the EE documentation, rechecked my php code, and done some searches and still cannot seem to find the issue.

    I appreciate any insight. Thank you!

     

     

  • #2 / Nov 21, 2013 2:57pm

    Victor Paredes

    7 posts

    I figured out the problem by switching my selector from url_title to entry_id. Please mark as answered.

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

ExpressionEngine News!

#eecms, #events, #releases