Help - Search - Members - Calendar
Full Version: can i integrate PHP in <MTEntries lastn="X"> tag?
Movable Type Community Forum > Additional Resources > Tips and Tricks
seba
i am trying to integrate a dynamic PHP variable in the
CODE
<MTEntries  lastn="X">
tag but cannot make it work.

does anyone know how/if it is possible?

sofar all my attempts of combining it with the MT code has failed. sad.gif

CODE
<MTEntries  lastn=" <? "PHP variable here"; ?>">


best

seba.
shelley
The reason this does not work is because Template Tags are processed by the Movable Type engine before the page is created, but PHP code is processed by the browser after the page is created.

So, you can't pass a PHP variable to a Template Tag in this manner because Movable Type isn't interpreting the PHP at all.

You could just write PHP/MySQL code to pull the entries you want straight from the database, rather than using the MTEntries tag to do it.
seba
QUOTE
The reason this does not work is because Template Tags are processed by the Movable Type engine before the page is created, but PHP code is processed by the browser after the page is created.

Ah! I see.

QUOTE
You could just write PHP/MySQL code to pull the entries you want straight from the database, rather than using the MTEntries tag to do it

Thanks, I will try that. I am not a PHP coder but usually quite skilled in hacking (copypasting/re-arranging) other people's scripts to fit my needs.

If someone has a link to a simple PHP script that does something similar to the above I would be grateful.

Thanks again. I really enjoy this forum. So much to learn...

x
seba
sad.gif

Hmm. I have been trying to find a simple php script that pulls entries from my MySQL database rather than using the MTEntries tag.

No luck so far.

Has anyone done this using a simple script? Or can anyone direct me to a php+mt resource site where I might find what I am looking for? biggrin.gif

Cheers,

s
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.