use of entry_id= when the URL contains the entry URL title
Posted: 07 July 2005 08:48 PM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  265
Joined  11-13-2002

I’m using a weblog to hold certain relatively static information for display on various pages (templates).  For example, I have the “about” text as an entry in the “info” weblog (it happens to be entry ID 28).  This works fine on the main site page and on the news weblog page, but elsewhere the exact same code displays nothing.  In fact, I think that it works fine provided the template is the index template, but doesn’t work otherwise.  Or, rather, it won’t work if the URL explicitly contains an entry URL title.

The “about” code looks like this:

{exp:weblog:entries weblog="info" entry_id="28"}
{body}
{
/exp:weblog:entries}

I (naively?) thought that the specification of a specific entry ID would override any automatic processing due to the entry URL title.  But is that wrong?  If a URL contains the entry URL title, does that get passed into the weblog:entries processing, thereby causing the entry_id=28 to fail?

Profile
 
 
Posted: 07 July 2005 08:49 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

You need to use dynamic=“off” to make it ignore information from the URL.

 Signature 
Profile
MSG
 
 
Posted: 07 July 2005 08:58 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
RankRank
Total Posts:  265
Joined  11-13-2002

Lisa - thanks, I’ll try that.  But can you answer another question?  I just tried this code change:

{exp:weblog:entries weblog="info" entry_id="28"}
{body}
{if no_results}
No content available
.
{/if}
{
/exp:weblog:entries}

And, instead of getting “no content available” (as I expected), instead, now, I’m getting entry 28’s body text!!!

Uh… why is that?

Profile
 
 
Posted: 07 July 2005 09:02 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

I’m confused.  If there is an entry 28, and it has results, why would if no results kick in?  Why would you even use this code if there were no results? ;p

Anyway, I don’t see {if no_results} listed in the variable pairs for that tag….

 Signature 
Profile
MSG
 
 
Posted: 07 July 2005 09:05 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
RankRank
Total Posts:  265
Joined  11-13-2002

Hey, I’m the one that’s confused!

There IS definitely an entry 28.  And, BTW, I just tried your dynamic=“off” and that worked (thanks!).

The reason I put in that conditional was just to see if the exp tag was doing anything at all.  ALSO, what I wanted to do was the following (this was before I read your suggestion): I was going to switch to using a template global variable in case the entry didn’t show up (previously I had been using a global variable for my “about” text).

But I can’t understand why the addition of that conditional would change the behavior of the tag.

Profile
 
 
Posted: 07 July 2005 09:08 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
RankRank
Total Posts:  265
Joined  11-13-2002

Regarding that conditional… what about—> here.

(edit by lj, why did you use email tags for a url? wink )

Profile
 
 
Posted: 07 July 2005 09:09 PM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

But if you’re specifying an entry_id then there *will be* results,I mean.. you wouldn’t have an id if that post didn’t exist, neh?

So I’m still confused.  BTW: have you seen the info on the wiki about static pages?  Since that’s what you’re trying to do, there maybe something useful there for ya.

(oh, and you’re right, I was looking in the wrong place, oops)

 Signature 
Profile
MSG
 
 
Posted: 07 July 2005 09:12 PM   [ Ignore ]   [ # 7 ]  
Lab Assistant
RankRank
Total Posts:  265
Joined  11-13-2002

Lisa - I think our posts crossed in cyberspace.  You’re looking at variable pairs, but the conditionals are listed separately (see the link I provided above).

Profile
 
 
Posted: 07 July 2005 09:15 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
RankRank
Total Posts:  265
Joined  11-13-2002

Lisa,

This is what I think (so far)...

With dynamic=“on” by default, entry ID 28 wasn’t being processed.  So, in theory, adding that conditional ought to have caused the text inside of it to show up.  But, actually, it didn’t work that way!  Instead, entry ID 28 was displayed!  I can’t explain it.  It is very late for me, so I am going to quit soon.  Tomorrow, I will redo these tests and verify that I can reproduce the same behavior.

EDITED:

1) I used an email tag just to test you!  wink

2) Regarding the wiki… I’ve read that before, and, in fact, since your dynamic=“off” was THE solution, I’m happy with that; however, I don’t like unsolved mysteries, so I am still going to play around with the odd behavior of the conditional (but later!).

Profile
 
 
Posted: 07 July 2005 09:17 PM   [ Ignore ]   [ # 9 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

Well, entry_id 28 always exists, so there are results - they just won’t be showing if the dynamic is on and the URL is showing a URL specified page.

I guess. I’m not sure, it’s not a tag I’ve played with. It could be a bug, I’m really just 100% unsure. =)

 Signature 
Profile
MSG
 
 
Posted: 07 July 2005 09:20 PM   [ Ignore ]   [ # 10 ]  
Lab Assistant
RankRank
Total Posts:  265
Joined  11-13-2002

OK—- thanks.

(Maybe the bug is that the presence of the conditional inadvertently switched EE over to non-dynamic processing?  But, it remains for me to reproduce this.)

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66467 Total Logged-in Users: 31
Total Topics: 84862 Total Anonymous Users: 11
Total Replies: 455332 Total Guests: 165
Total Posts: 540194    
Members ( View Memberlist )