Possible to pass template variable to PHP?

Post Reply
vrocks
Posts: 22
Joined: Tue Mar 05, 2013 10:32 pm

Possible to pass template variable to PHP?

Post by vrocks »

I want to add this code to the RSS feed template, subtemplate:

Code: Select all

<enclosure url="<!--THUMB_URL-->" length="<? echo filesize("/web/sites/domain.com/" . parse_url("<!--THUMB_URL-->",PHP_URL_PATH)); ?>" type="image/jpeg" />
If the THUMB_URL was parsed before the PHP code then this should work. It seems the PHP is parsed first?
vrocks
Posts: 22
Joined: Tue Mar 05, 2013 10:32 pm

Re: Possible to pass template variable to PHP?

Post by vrocks »

Code: Select all

<pubDate><?=date('r', strtotime('<!--ACTIVATION_DATE-->'))?></pubDate>
That code from the WIKI also doesn't work correctly...

Code: Select all

<pubDate>Wed, 31 Dec 1969 19:00:00 -0500</pubDate>
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Possible to pass template variable to PHP?

Post by admin »

Why do you think it doesn't work ?
Don't forget to run script update
vrocks
Posts: 22
Joined: Tue Mar 05, 2013 10:32 pm

Re: Possible to pass template variable to PHP?

Post by vrocks »

Notice in my own reply that the date wasn't output by your script so the timestamp shows default for 0 seconds from epoch.
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Possible to pass template variable to PHP?

Post by admin »

what actual date for you have in admin for that thumb >
Don't forget to run script update
vrocks
Posts: 22
Joined: Tue Mar 05, 2013 10:32 pm

Re: Possible to pass template variable to PHP?

Post by vrocks »

Code: Select all

2013-12-01 20:10:13
I am going to run a test right now where I hardcode the date and I don't.
vrocks
Posts: 22
Joined: Tue Mar 05, 2013 10:32 pm

Re: Possible to pass template variable to PHP?

Post by vrocks »

Now it is working... Gremlins!

I swear it didn't work for me before. All dates for all thumbs were epoch. So now I am working on the original problem. The thumbnail size in bytes.

It should give me the number but is instead blank. Testing it in a file with a hardcoded thumbnail URL plucked from the RSS feed it works.

http://www.messedupshit.com/bytes.php
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Possible to pass template variable to PHP?

Post by admin »

There's no tag to output thumb's size in bytes so you have to use your own code
Don't forget to run script update
Post Reply