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.

Basic Weblog Display Question

December 03, 2008 7:42pm

Subscribe [3]
  • #1 / Dec 03, 2008 7:42pm

    Lucas Mays

    8 posts

    So I’m new to the Expression Engine game and am using it to build a basic content website.

    I’m wondering how to display a weblog entry by name. Is this possible?  I know that you can display with a limit and by entry_id, but I’m trying to use segments to control which weblog entry to display.

    I’m trying to display my about section content by segment essentially.

    Here’s my simple code:

    {exp:weblog:entries weblog="about_ozone" disable="categories|member_data|pagination|trackbacks"}
    {page_body}
    {/exp:weblog:entries}

    Where my weblog “about_ozone” contains multiple entries of course.

    I figured this would be simple, but perhaps I’m overlooking something or a better way to implement.

    Thanks in advance for any pointers.

  • #2 / Dec 03, 2008 9:14pm

    PXLated

    1800 posts

    You mention segments but don’t give an example of a typical URL with the segments…So, I’ll give a general example…

    Typical URL:
    http://www.example.com/index.php/templateGroup/template/segment_3
    http://www.example.com/index.php/templateGroup/template/url_title

    Typical weblog:entries tag using a URL segment:
    {weblog:entries weblog="about_ozone" limit="1" url_title=”{segment_3}}

    That combination would display 1 entry with the URL title found in segment #3 using a template from a templateGroup.


    Does that help or am I missing what you’re after?

  • #3 / Dec 03, 2008 9:26pm

    Lucas Mays

    8 posts

    Thanks for your response, it just occurred me that my issue was the non-use of the url_title parameter in the weblog:entries tag.  Essentially it is the “name” I was looking for.

    Ah, to be a novice.

    Thanks again for the help, I’m finding that the simpler things are harder at my current stage…

  • #4 / Dec 03, 2008 9:34pm

    PXLated

    1800 posts

    It’s always the simple things 😊
    Good luck with your site!

  • #5 / Dec 03, 2008 9:34pm

    Lucas Mays

    8 posts

    One more quick question.

    If I’m using a line of code as you suggested:

    {weblog:entries weblog=“about_ozone” limit=“1” url_title=”{segment_3}”}

    If segment_3 doesn’t exist, is it treated like segment_2?  Aka, do segment variables roll down so to speak.

    It seems to be working fine but I want to make sure I’m not using seriously bad logic.

  • #6 / Dec 03, 2008 9:42pm

    Lucas Mays

    8 posts

    Ha, it actually doesn’t work as I thought.  Nevermind the above, I thought I came across something automated, but it’s just normal as it should be.

  • #7 / Dec 03, 2008 9:48pm

    PXLated

    1800 posts

    What do your links/urls look like?

  • #8 / Dec 03, 2008 10:01pm

    Lucas Mays

    8 posts

    Here’s what I’m trying to do:

    I have segment levels on my about page

    //my general about page
    http://localhost:8888/ee/index.php/about_ozone 

    //my sub content
    http://localhost:8888/ee/index.php/about_ozone/news
    http://localhost:8888/ee/index.php/about_ozone/privacy_policy

    //my “who we are” sub content
    http://localhost:8888/ee/index.php/about_ozone/who_we_are/overview
    http://localhost:8888/ee/index.php/about_ozone/who_we_are/people_profiles
    http://localhost:8888/ee/index.php/about_ozone/who_we_are/animal_profiles

    The sub content is controlled my a left nav within the about page.
    What I’m trying to do is only use one Weblog about_ozone to hold the content for all three of these levels as they are very similar.

    Thus, to access them it will be something like:
    {exp:weblog:entries weblog="about_ozone" limit="1" url_title="{if segment_3 != ""}{segment_3}{if:else}{if segment_2 != ""}{segment_2}{if:else}{segment_1}{/if}{/if}” disable=“categories|member_data|pagination|trackbacks”}
    {page_body}
    {/exp:weblog:entries}

    Can you do something like this?

  • #9 / Dec 04, 2008 2:30am

    PXLated

    1800 posts

    Answering out of order…

    What I’m trying to do is only use one Weblog about_ozone to hold the content for all three of these levels as they are very similar.

    First, just to make sure there is understanding, weblogs are just data containers, what’s displayed is controlled via weblog tags in templateGroups/templates that are called through the url.

    Can you do something like this?

    Don’t think (almost positive) you can’t put conditionals within the weblog:entries tag.

    —————

    Using EE native (normal) functionality…

    //my general about page
    http://localhost:8888/ee/index.php/about_ozone

    Will display the index template in the about_ozone template group

    //my sub content
    http://localhost:8888/ee/index.php/about_ozone/news
    http://localhost:8888/ee/index.php/about_ozone/privacy_policy

    Will normally display the news or privacy_policy templates within the about_ozone template group

    //my “who we are” sub content
    http://localhost:8888/ee/index.php/about_ozone/who_we_are/overview
    http://localhost:8888/ee/index.php/about_ozone/who_we_are/people_profiles
    http://localhost:8888/ee/index.php/about_ozone/who_we_are/animal_profiles

    Will normally display (using the url_tile) the single entry “overview” entry (etc) in the who_we_are template within the about_ozone template group

    —————

    Based on your attempted conditionals, are you trying to display all this content through just one template or are you going to have index, privacy_policy and who_we_are templates within the about_ozone template group?

  • #10 / Dec 04, 2008 8:59pm

    Lucas Mays

    8 posts

    I am attempted to display them all in one about_ozone template within my default site group.  It sounds like it would make more sense to parse out an about_ozone template group with templates for who_we_are, news, and privacy policy like you said.  The who_we_are would then have 3 weblog entries which I can display with url_title.

    I have a feeling I’m trying to over optimize for no reason in this case.

  • #11 / Dec 04, 2008 9:13pm

    PXLated

    1800 posts

    It’s always a balance between optimizing with a minimum of templates and just fighting the system. You can actually run a whole site through one template (Rick Ellis did once) but it can get unwieldily with all the conditionals. I’ve gone both ways - too many templates and too few. The natural EE system is templateGroup/template/something, if you work within that structure, a lot of things are automatic. Just remember, weblogs = content/data and templates = url/display/presentation.

  • #12 / Dec 04, 2008 9:20pm

    Lucas Mays

    8 posts

    Werd.  Will do, and thanks much

  • #13 / Dec 04, 2008 10:39pm

    PXLated

    1800 posts

    Did I actually help or answer your question? I got somewhat distracted here at work :-(

  • #14 / Dec 05, 2008 12:45am

    Stephen Slater

    366 posts

    I may have missed it while scanning through this thread, but something to make sure of when linking to the template that dynamically pulls in the weblog data is to use {url_title_path=""}.  This will automatically append the url_title to the end of your url structure.

    If you use {path=""} variable, you’ll need to rely on the url_title= parameter to pull in the specific entry.

    Make sense?

  • #15 / Dec 05, 2008 2:05am

    Lucas Mays

    8 posts

    PXLated - Yes you helped, and thanks.

    StephenSlater - Yes, it does make sense, I will investigate utilizing url_title_path in my implementation. I’ll be sure to holla back if I have any questions 😊

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

ExpressionEngine News!

#eecms, #events, #releases