Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2006-10-21 21:26:38

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: (4.0.4) PHP error in publish.php

Neil, you cannot use TXP tags within TXP tags, but it can be done like this:

<a href="javascript://" onclick="getMyHTML('http://westserve.org/bibletext.php?passage=<txp:php>echo urlencode(custom_field(array('name' => 'custom1')));</txp:php>','bibletext');" title="Show ESV Bible text for <txp:custom_field name="custom1" />" ><txp:custom_field name="custom1" /></a></p>

… or you can use asy_wondertag

Last edited by ruud (2006-10-21 21:31:09)

Offline

#14 2006-10-21 21:31:14

NeilA
Member
From: Blue Mountains, Australia
Registered: 2004-08-15
Posts: 316
Website

Re: (4.0.4) PHP error in publish.php

Thank you Rudd! Works beautifully.

Cheers


Neil – Blue Mountains, Australia

http://westserve.org
http://ministrygrounds.net.au

Offline

#15 2006-10-22 06:10:07

blumie607
Member
Registered: 2004-03-08
Posts: 175
Website

Re: (4.0.4) PHP error in publish.php

I am having a very similar problem. When I change my PHP code to use the txp:php tags, it doesn’t work. When I use the <?php ?> tags, it works, but in LIVE mode, I am getting the error at the top of the page. And I am using 4.0.4…


bludrop studios .::. Creative Expression

Offline

#16 2006-10-22 08:19:03

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: (4.0.4) PHP error in publish.php

You need to post what you’re trying to use so we can help.

Offline

#17 2006-10-22 19:38:20

blumie607
Member
Registered: 2004-03-08
Posts: 175
Website

Re: (4.0.4) PHP error in publish.php

Okay, although the PHP that I am using is trivial (or at least it looks like it is)….

<?php $thispage="homeb"; ?> at the top of every TXP page (different thispages for different sections)

<li <?php if ($thispage=="homeb") {
      echo "class=\"selected\""; }
elseif ($thispage=="newsb") {
 echo "class=\"selected\""; 
}
?>>

in the navigation bar form which is reflected in the menubar at the top of every page

and <body id="<?php echo $thispage; ?>"> in the header form which is reflected in the body tag of each page

When I change all of those <?php and ?> tags to <txp:php> and </txp:php> it stops working. And when I keep them as they are (without using the TXP tags), I get the PHP error at the top of the page in live mode.

Thanks


bludrop studios .::. Creative Expression

Offline

#18 2006-10-22 21:12:59

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: (4.0.4) PHP error in publish.php

Try this at the top of the page:

<txp:php>
  global $blu_thispage;
  $blu_thispage="homeb";
</txp:php>

And this in your navigation bar form:

<li<txp:php>
  global $blu_thispage;
  if ($blu_thispage=="homeb" or $blu_thispage=="newsb") echo ' class="selected"';
</txp:php>>

I’m using $blu_thispage instead of $thispage, because $thispage is a variable that is also used internally in Textpattern. Not sure if the global lines are needed.

Last edited by ruud (2006-10-22 21:18:04)

Offline

Board footer

Powered by FluxBB