Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-12-23 10:05:38
- jstur8jv
- Member
- Registered: 2006-12-23
- Posts: 23
How do I pass a variable from the URL to a tag's parameter?
Say I’d like to use some of the extra functionality of a tag (like a tag for the plugin upm_image, just for example…).
Say that for the tag’s parameter [image_id=”“], I’d like the parameter to equal whatever is the “&p=” from the url.
How could I make that work?
I tried putting php into the form, but it didn’t work.
<upm_image image_id="<txp:php>echo $_GET['p'];</txp:php>" />
I’d like a generic solution I could apply to any tag, if possible. It seems like something that should be possible.
Thanks!
Last edited by jstur8jv (2006-12-23 18:09:34)
Offline
Re: How do I pass a variable from the URL to a tag's parameter?
asy_wondertag helps to use txp tags as attributes to other txp tags.
Offline
#3 2006-12-23 18:16:05
- jstur8jv
- Member
- Registered: 2006-12-23
- Posts: 23
Re: How do I pass a variable from the URL to a tag's parameter?
I actually found that plugin myself shortly after posting!
Here’s the code I used to get the functionality I wanted, using the upm_img plugin and asy_wondertag:
<txp:asy_wondertag><txp:upm_image image_id="<txp:php>echo $_GET['p'];</txp:php>" ><txp:upm_img_caption /></txp:upm_image></txp:asy_wondertag>
That will return the description of the image you are currently looking at in a category.
I’m using it to put together a simple photo blog that runs entirely through the admin interface:
photo categories = photo albums
pictures are put into a certain album by selecting a certain category
and the captions are displayed with the picture (i.e., “Me and Jane @ the beach”, or whatever)
That was the first piece of php I ever wrote! I was super-proud. A few hours later, I wrote an if…else statement. And then a few hours after that, i wrote an if… else statement that checked two variables!
Totally crazy. I’m proud of myself, anyway. Thanks for the help.
Offline