Selected Entries Feature
Posted: 13 August 2004 09:55 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  258
Joined  01-21-2003

Would like to be able to designate certain entries for “marquee presentation” on my website. Right now, I can show “most recent” posts, and with a plugin, I can show most popular posts, but it would be really nice if I could designate certain entries to be featured as, for want of a better term, “most important.” I don’t want to use the sticky designation for this, because I do not want the posts to be featured out of order in the main blog. I know I could create a separate category, but that is not an elegant solution, particularly since that second category shows up in my blog after each entry where the category for that entry is displayed.

Profile
 
 
Posted: 13 August 2004 10:15 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32911
Joined  05-14-2004

How about creating another field and using that to display the posts?  Seems like the easiest way to do it and one of the great things about custom fields. =)

 Signature 
Profile
MSG
 
 
Posted: 14 August 2004 01:29 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  258
Joined  01-21-2003

Well, I tried that, and I must be doing something wrong. I created a custom field called “significant,” and for each entry worth keeping accessible in the menu, I enter the text “keeper” in that field. Then, in my menu, I created this conditional test and entry display:

<h2 class="sidetitle">Significant Entries</h2>
<
ul>
{if significant != "keeper"}
{exp
:weblog:entries orderby="date" sort="desc" weblog="weblog1" dynamic="off"}
<li><a href="{title_permalink=weblog/index}">{title}</a></li>
{/exp:weblog:entries}
{
/if}
</ul>

I know I am doing something incredibly dumb, but what is it?

Profile
 
 
Posted: 14 August 2004 02:12 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32911
Joined  05-14-2004

That says if significant is not equal to keeper, and if it’s a custom field I believe it needs to be inside the exp:weblog tags.

You want == for if it’s equal to keeper, too…. I think. =)

 Signature 
Profile
MSG
 
 
Posted: 14 August 2004 03:10 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  258
Joined  01-21-2003

Duh. I even read the reminder about the double = sign. As I said, “dumb.”

This works great:

<h2 class="sidetitle">Significant Entries</h2>
<
ul>
{exp:weblog:entries orderby="date" sort="desc" weblog="weblog1" dynamic="off"}
{if significant
!== "keeper"}
<li><a href="{title_permalink=weblog/index}">{title}</a></li>
{/if}
{
/exp:weblog:entries}
</ul>

Thanks!

Profile
 
 
Posted: 14 August 2004 03:24 PM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32911
Joined  05-14-2004

That is strange…. !== is not proper code, these are the conditionals:

You can use any of the following operators:

  * == “equal to”
  * != “not equal to”
  * < “less than”
  * <= “less than or equal to”
  * > “greater than”
  * >= “greater than or equal to”
  * <> “not equal to”


You might want to fix that or you may get unpredictable results. =)

 Signature 
Profile
MSG
 
 
Posted: 14 August 2004 03:53 PM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  281
Joined  11-30-2002

Another way you could do it is by creating a new custom entry status and assign that status to your important posts.

Profile
 
 
Posted: 14 August 2004 05:04 PM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  258
Joined  01-21-2003

Sorry LisaJill.

{if significant !== “keeper”} was an old cut & paste. I am actually using:

{if significant == "keeper"}

Profile
 
 
Posted: 14 August 2004 05:05 PM   [ Ignore ]   [ # 8 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32911
Joined  05-14-2004

Excellent, Greg.  Just wanted to make sure things are right for ya. =)

 Signature 
Profile
MSG
 
 
Posted: 14 August 2004 05:22 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  258
Joined  01-21-2003

I appreciate your help; I have exactly what I want now.

Profile
 
 
Posted: 15 August 2004 06:16 AM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  258
Joined  01-21-2003

Actually, I have a question. Any thoughts on why one entry in particular would come up blank? The code is extracting the list of entries and displaying them by title in my sidebar. And clicking on each of them reloads the page with just that one entry displayed. Except for one of them. I have renamed the entry, edited out the field data that caused it to be displayed, changed its date slightly, etc. Alone among all these selected entries, it continues to come up blank when clicked on. Interestingly, the rest of the page renders around it, i.e., it is not stopping the page from finishing. It appears normally in the blog, as well as in its respective archive. Anything in particular should I be looking for? It’s here in the left-hand sidebar under Significant Entries. The entry is called ‘13’.

Thanks.

Profile
 
 
Posted: 15 August 2004 06:18 AM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  258
Joined  01-21-2003

spacey310, thanks for that suggestion. Looks to me like that could act much the same way that a custom field would, perhaps a touch more elegant in appearance. But it also looks true to me that an entry can only have one status, and I have not thought through the implications of that choice. Are there any?

Profile
 
 
Posted: 15 August 2004 09:55 AM   [ Ignore ]   [ # 12 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9868
Joined  06-19-2002

I think the separate status might be the best solution.  You are correct that an entry can only have a single status, but this shouldn’t be a problem.  Basically:

- where you normally list entries you’d just specify status=“open|highlighted” so that all the entries are listed just like before

- where you want only the special entries you’d use status=“highlighted”


Now, as for the entry not appearing… are you sure it belongs to a weblog/category that is allowed by your normal/main {exp:weblog:entries} tag on the page.  If you have a particular “weblog” specified and the post belongs to a different one then it won’t appear.

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 15 August 2004 10:18 AM   [ Ignore ]   [ # 13 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  258
Joined  01-21-2003

Thanks Chris. I do like that suggestion. As for my entry, yep, up and down, it looks identical to my others, and in my mySQL tables, it looks the same as well.

Profile
 
 
Posted: 15 August 2004 11:07 AM   [ Ignore ]   [ # 14 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  258
Joined  01-21-2003

Chris:

With respect to the missing entry, its title is ‘13’. Is there any reason that the fact it is only a number might cause the problem? I ask because I discovered something similar with another entry titled ‘4:44’. It also comes up blank when clicked on from my Highlighted Entries sidebar. And I just did a test with a new entry with the title ‘372’. It also comes up blank. What is interesting is that, if I change the title to include letters or words, clicking on them still brings them up blank, but if I change the URL Title to include a word and underscore, but leave the Title the same, it comes up correctly. Does this qualify as a bug, or just a little bit of a “gotcha”?

Profile
 
 
Posted: 15 August 2004 02:12 PM   [ Ignore ]   [ # 15 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9868
Joined  06-19-2002

If the “URL Title” of an entry starts with a number, then when it’s actually in the URL then EE is going to be triggered to think that it is actually the “Entry ID” and not a “URL Title”.

So, in your case, clicking on the entry will produce a “13” in the URL.  EE thinks you’re looking for “entry 13”, which I’m guessing either doesn’t exist or belongs to a different weblog/category and thus can’t be displayed.

So, basically, if you’re going to be using URL Titles in your links then you should be sure that all your URL Titles begin with a letter and not a number.

 Signature 

Chris Curtis
chriscurtis.org

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: 65027 Total Logged-in Users: 41
Total Topics: 82116 Total Anonymous Users: 25
Total Replies: 441310 Total Guests: 171
Total Posts: 523426    
Members ( View Memberlist )