Page 1 of 1
Hiding date for entries not shown on front page?
Posted: Fri Aug 22, 2008 9:03 pm
by Mangek
Good evening!
I have a couple of entries that I've hidden from the front page, containing links and a gallery and such (I don't want to use static pages, I still want the comments).
My question is whether it'd be possible to hide the date for these entries? Perhaps in the same way the 'sticky'-text is not shown when the entry isn't stickied?
I don't know much of the smarty syntax, so I won't solve this one myself.
Thanks much!

Re: Hiding date for entries not shown on front page?
Posted: Sun Aug 24, 2008 12:36 am
by garvinhicking
Hi!
It depends a bit on your template. If you use a template that shows the date for each entry again and again, and not only once for all entries of the same day, you can easily create a custom field called something like "hide_date" and then set that to "1" or "true" for every entry that should get no date. Then inside your entries.tpl you would just make an "{if $entry.properties.ep_hide_date != ''}" smarty check around the output of your date.
If the date is emitted not for entries themselves, but rather for dategroups, this won't work. You must then change the template and shuffle the foreach-loops where the date is printed within the main loop, resulting in slightly more work.
HTH,
Garvin
Posted: Sun Aug 24, 2008 12:45 am
by Don Chambers
Hey Garvin - how about {if $entry.properties.ep_no_frontpage ='true'}?? Then the date hiding would correspond exactly to the flag already set for hiding the entry from the frontpage, and an additional custom extended property field would not be necessary....
Posted: Sun Aug 24, 2008 12:46 am
by Mangek
Awesome, that works like a charm, Garvin! Thank you so much!

Posted: Sun Aug 24, 2008 12:47 am
by garvinhicking
Hi Don!
Well, if the no-frontpage option is set, the entry doesn't even show up on the frontpage...I was reading the question like it was about the frontpage, not the entry detail page?
Of course if it's all only about the entry detail page, then one should use this variable, you are right!
Regards,
Garvin
Posted: Sun Aug 24, 2008 12:48 am
by Mangek
Don Chambers wrote:Hey Garvin - how about {if $entry.properties.ep_no_frontpage ='true'}?? Then the date hiding would correspond exactly to the flag already set for hiding the entry from the frontpage, and an additional custom extended property field would not be necessary....
Yeah, actually I added 'true' to the code and wrote true in the field to make it happen.
Edit: I read your answer too fast, I'm a little tired. If what you say means I don't have to type anything extra (they won't be on the front page, ever) that'd be great!

Posted: Sun Aug 24, 2008 12:52 am
by Mangek
Actually, I changed it to
Code: Select all
{if $entry.properties.ep_no_frontpage ='true'}
and now I get a fatal error.

Posted: Sun Aug 24, 2008 12:56 am
by Don Chambers
Sorry, that should be 2 equal signs....
Code: Select all
{if $entry.properties.ep_no_frontpage =='true'}
Posted: Sun Aug 24, 2008 1:00 am
by Mangek
== hid the date from all instances, both frontpage and entry detail page. != however, did the trick! Thanks!

Posted: Sun Aug 24, 2008 1:06 am
by Don Chambers
I didn't look at more than a single entry... looks like $entry.properties.ep_no_frontpage does not exist at all for entries that are not hidden, so the first instance of it occuring sets it to true, and it never gets set to anything else.
This MIGHT work:
Code: Select all
{if $entry.properties.ep_no_frontpage}
Then again, if you already have a solution, there is probably no reason to change it except for curiosity. My point was simply to use the same ep field that already exists rather than creating a new one... that way, your single check of "hide from frontpage" solves both of your objectives.
Posted: Sun Aug 24, 2008 1:12 am
by Mangek
Heh actually, {if $entry.properties.ep_no_frontpage} did just the oposite of what I wanted..

(Yeah, I was curious enough to try it -- less code means more fun).
I'll go with the !=, it worked fine. Many thanks Don!

Posted: Sun Aug 24, 2008 1:14 am
by Don Chambers
Well, it probably did the exact opposite because I never saw the balance of your code - you could either be printing, or supressing, the date. Regardless of HOW you got it to work, at least it does!!
