Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2013-06-26 12:16:32
- lumin161
- Member
- From: Czech Republic
- Registered: 2012-03-29
- Posts: 10
PHP in headline
It is possible to use PHP in headline? If I use <txp:php> textpattern show all this characters in headline.
Offline
Re: PHP in headline
Hi, what do you mean with headline? would that be the title?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#3 2013-06-26 13:12:49
- lumin161
- Member
- From: Czech Republic
- Registered: 2012-03-29
- Posts: 10
Re: PHP in headline
Exactly… :) Title
Offline
Re: PHP in headline
I don’t think you can add php in titles as it is also used for the url structure too.
Can you explain more as to what you are trying to achieve? Somebody here will definitely be able to offer a work around.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#5 2013-06-26 13:57:30
- lumin161
- Member
- From: Czech Republic
- Registered: 2012-03-29
- Posts: 10
Re: PHP in headline
Ok.
Example is here: http://www.mhd-olomouc.cz/MOSD/detail-vozidla?ident=153
This is one page named as “Details of vehicle”.
This page getting information about concrete vehicle from database (via $_GET[]; )
I wish i can use the number of vehicle in the title. It means the title will be “Detail vozidla 160” (Details of vehicle nr. 160).
Now it’s separate and the number of vehicle is in the arcticle body.
Offline
Re: PHP in headline
You can replace <txp:title />
with <txp:title /> <txp:php>echo intval(gps('ident'));</txp:php>
in the corresponding article form. adi_gps
or etc_query
plugins can be used for conditional control:
<txp:title /><txp:etc_query data="{?ident||intval}" globals="_GET"> {?}</txp:etc_query>
Edit: and if you absolutely need <txp:php>
in titles, try to replace <txp:title />
with
<txp:etc_query data="{?title||parse.escape_title}" globals="thisarticle" />
Mind, however, that you should then avoid using <txp:page_title />
tag.
Last edited by etc (2013-06-26 14:50:26)
Online
Re: PHP in headline
Is there a reason you are not naming the article Detail vozidla 160
?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#8 2013-06-26 18:47:03
- lumin161
- Member
- From: Czech Republic
- Registered: 2012-03-29
- Posts: 10
Re: PHP in headline
Yes… The article is for all vehicles… From 1 to 776. :)
The article is still one, but informatinos, photo data etc. are loaded from database…
Etc.- i need to use select (not only GET) it is possible in this way?
Offline
Re: PHP in headline
lumin161 wrote:
i need to use select (not only GET) it is possible in this way?
Most probably yes, if you provide more details: what kind of select (HTML, SQL, …) you mean? To query db you could go this way:
<table class="mosd_table_detailvozu">
<txp:etc_query data="SELECT * FROM my_table WHERE ident={?ident|0|intval}" globals="_GET" wraptag="tbody" break="tr">
<td><strong>Značka:</strong></td><td>{znacka?}</td>
<td><strong>Typ:</strong></td><td>{typ?}</td>
...
</txp:etc_query>
</table>
assuming znacka
, typ
etc are the appropriate fields names.
Last edited by etc (2013-06-26 21:23:39)
Online
Pages: 1