Query sometimes works, sometimes doesn’t
Posted: 10 July 2005 09:45 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  752
Joined  08-16-2003

I have two related questions. First, I am using this code:

<p>{exp:weblog:entries weblog="blog1|blog2|blog3|blog4|blog5" limit="5"}
{exp
:query sql="SELECT blog_name FROM exp_weblogs WHERE weblog_id = '{weblog_id}' LIMIT 1"}
{blog_name}
{
/exp:query}
{
/exp:weblog:entries}</p>


and

<p>{exp:comment:entries sort="desc" orderby="date" limit="5" dynamic="off" weblog="blog1|blog2|blog3|blog4|blog5"}
{exp
:query sql="SELECT blog_name FROM exp_weblogs WHERE weblog_id = '{weblog_id}' LIMIT 1"}
{blog_name}
{
/exp:query}
{
/exp:comment:entries}</p>

Why does the first example work as expected (it prints <p>blog1 blog2 blog3 blog1 blog5</p>), while the second example prints nothing?

My second question is: is there an easier way to retrieve the blog short name than using the Query module in these contexts? As far as I can tell I have access to {weblog} (the long name) and {weblog_id} (which I use above), but not something like {weblog_shortname}.

Thanks in advance for any help you can toss my way. You can IM me if you like.

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 10 July 2005 12:25 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

The closest there is is the weblog infor but it doesn’t have the shortname.

Why are you after the shortname?  If you can tell us exactly what you’are trying to accomplish, it’d be easier to help you with a solution. =)

 Signature 
Profile
MSG
 
 
Posted: 10 July 2005 05:53 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  752
Joined  08-16-2003

Basically I want to use the shortname as a segment in a URL. I may or may not stick to that plan; I’m exploring some other options right now.

Regardless, can you see anything wrong with the code I posted above? Why does one work while the other doesn’t?

 Signature 

Pst… have you taken a look at Weever yet?

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: 25
Total Topics: 84859 Total Anonymous Users: 16
Total Replies: 455330 Total Guests: 174
Total Posts: 540189    
Members ( View Memberlist )