An entry index numb var available from the template?

Discussion corner for Developers of Serendipity.
Post Reply
Stosh
Regular
Posts: 75
Joined: Mon Oct 12, 2009 11:47 pm

An entry index numb var available from the template?

Post by Stosh »

I have spent quit a bit of time searching, and have even tried "$entry.index" just to see if anything displayed.

I am working on a set of share/bookmark/tweet buttons, and have tripped over the twitter 140 character (SMS, of course) limit. I made my own small-urls by using truncate:19:"":true which was enough to assure the first five characters of the url (which include the index number) are handed to the mod_rewrite rules. Just tacked a new ".html" onto the end of it, and it worked fine.

It would be nice to simply hand in JUST the index number there (less kludgy). Trouble is, I can't find anything that tells me where to find the variable with just the index number in it. I'd guess it is one of the properties of $entry, but, well, I can't find the reference manual for it.

Thanks if you can help.

-djr
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: An entry index numb var available from the template?

Post by garvinhicking »

Hi!

{$entry.id} :-)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Stosh
Regular
Posts: 75
Joined: Mon Oct 12, 2009 11:47 pm

Re: An entry index numb var available from the template?

Post by Stosh »

Garvin

Ha! Why didn't I think of that. Thank you.

-djr
Stosh
Regular
Posts: 75
Joined: Mon Oct 12, 2009 11:47 pm

Re: An entry index numb var available from the template?

Post by Stosh »

Also, for lurkers who may be setting up their own small-twitter urls:

You will need to include a trailing dash after the $entry.id number. (e.g., ".../42-.html" i.e., "...{$entry.id}-.html").

I didn't go back and look to see why the mod_rewrite rules require it, but it is easier just to add the extra dash-character than to try to re-write the rewrite rules with all the unintended consequences that may entail :P

-djr
Post Reply