Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-04-07 12:52:41
- avetma
- Member
- Registered: 2006-03-11
- Posts: 28
PHP in textpattern
Hello,
I have been working with rss_thumbpop plugin and I have to set up some php code in page in order to set multiple categories.
Categories depends on url.
Watch for $cc variable in code!
For example, URL for this code would be index.php?s=gallery&cc=portreti
Here’s code:
<txp:php>
if($cc==“portreti”)
{
< /txp:php>
< txp:rss_thumbpop category=“portreti” orderby=“datedesc” mode=“float” limit=“200” pagepop=“1” padheight=“100” />
< txp:php>
}
< /txp:php>
This is not working; error:
Parse error: syntax error, unexpected $end in /home/…/public_html/textpattern/publish/taghandlers.php(1726) : eval()’d code on line 4
Parse error: syntax error, unexpected ‘}’ in /home/…/public_html/textpattern/publish/taghandlers.php(1726) : eval()’d code on line 2
Any help appriciated.
Thank you,
Ante
Last edited by avetma (2006-04-07 12:54:39)
Offline
Re: PHP in textpattern
http://textpattern.com/faq/34/how-do-i-use-php-code (See escaping to html)
You could also call rss_thumbpop() function directly and pass the attribtes as an associative array.
Offline
#3 2006-04-07 13:36:31
- avetma
- Member
- Registered: 2006-03-11
- Posts: 28
Re: PHP in textpattern
< txp:php>
if($cc==“portreti”)
{
echo “< txp:rss_thumbpop category=\“Portreti\” orderby=\“datedesc\” mode=\“float\” limit=\“200\” pagepop=\“1\” padheight=\“100\” /> “;
}
< /txp:php>
Still nothing. Now there is no error; but no images showed neither.
Like cathegory is empty… But it isn’t…
Thank you,
Ante
Last edited by avetma (2006-04-07 13:37:05)
Offline
Re: PHP in textpattern
You could also call rss_thumbpop() function directly and pass the attribtes as an associative array.
avetma, you did not call the rss_thumbpop function, you echoed an txp-tag!
Have a look at your html and you will find it.
Try something like this
<pre><code>
< txp:php>
if($cc==”portreti”)
{
$myAtts[‘category’] = ‘Portreti’;
$myAtts[‘orderby’] = ‘datedesc’;
$myAtts[‘mode’] = ‘float’;
etc..
echo rss_thumbpop($myAtts);
}
< /txp:php>
</code></pre>
I did not tested it, but should work this way
Offline
#5 2006-04-07 14:18:11
- avetma
- Member
- Registered: 2006-03-11
- Posts: 28
Re: PHP in textpattern
:( This is not working too…
< txp:php>
if($cc==“portreti”)
{
$myAtts[‘category’] = ‘Portreti’;
$myAtts[‘orderby’] = ‘datedesc’;
$myAtts[‘mode’] = ‘float’;
$myAtts[‘limit’] = ‘200’;
$myAtts[‘pagepop’] = ‘1’;
$myAtts[‘padheight’] = ‘100’;
echo rss_thumbpop($myAtts);
}
< /txp:php>
Still not displaying anything like category is empty :(
Offline
Re: PHP in textpattern
A question: What is $cc?
I know $c is categorie, but i don’t know $cc.
Perhaps setting site’s status to “debugging” is helpfull.
Offline
#7 2006-04-07 15:42:48
- KurtRaschke
- Plugin Author
- Registered: 2004-05-16
- Posts: 275
Re: PHP in textpattern
Are you expecting to $cc
to be populated with the value of the ?cc=
parameter in the URL? If so, you’ll need a line like $cc = gps('cc');
. TXP doesn’t automatically extract the URL parameters.
-Kurt
Last edited by KurtRaschke (2006-04-07 15:44:08)
kurt@kurtraschke.com
Offline
#8 2006-04-07 15:53:39
- avetma
- Member
- Registered: 2006-03-11
- Posts: 28
Re: PHP in textpattern
Thank you very much, it is working now!
Offline
Pages: 1