Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-09-04 10:23:11
- wimmaskerdrie
- New Member
- Registered: 2007-09-04
- Posts: 5
Array (PHP) in article
I need an array in PHP in an article:
I use:
<txp:php>
$gegevens[]="1|Test";
$gegevens[]="2|Test2";
</txp:php>
and it throws “Parse error: parse error, unexpected $end, expecting T_NEW or T_STRING or T_VARIABLE or ‘$’ in…”
How do I properly write the Array-syntax?
This must be correct?
Offline
Re: Array (PHP) in article
wimmaskerdrie wrote:
it throws “Parse error: parse error, unexpected $end, expecting T_NEW or T_STRING or T_VARIABLE or ‘$’ in…”
This is because Textile tries to beautify your quotes, which is nothing PHP has learned to value.
Prefix you piece of code with notextile. if it doesn’t contain empty lines, or embrace it with <notextile>...</notextile> tags if you wanted to shield a longish PHP snippet from Textile.
Offline
#3 2007-09-04 11:57:38
- wimmaskerdrie
- New Member
- Registered: 2007-09-04
- Posts: 5
Re: Array (PHP) in article
Thanks a lot.
1 more question. Why can’t i use empty lines like this:
<txp:php><notextile>
global $film;
global $gegevens;
//Comment
$gegevens[]=“1|Test”;
</notextile></txp:php>
Offline
Offline
#5 2007-09-05 06:55:24
- wimmaskerdrie
- New Member
- Registered: 2007-09-04
- Posts: 5
Re: Array (PHP) in article
No.
If I do this:
<notextile><txp:php>
global $film;
global $gegevens;
//Nieuwe regel op deze manier onderdaan zetten JanW
$gegevens[]=“1|Test”;
</txp:php></notextile>
It throws the error unexpected “<”
When I do this:
<notextile><txp:php>
global $film;
global $gegevens;
//Nieuwe regel op deze manier onderdaan zetten JanW
$gegevens[]=“1|Test”;
</txp:php></notextile>
it works.
Offline
#6 2007-09-06 06:57:47
- wimmaskerdrie
- New Member
- Registered: 2007-09-04
- Posts: 5
Re: Array (PHP) in article
Anyone?
Offline
Re: Array (PHP) in article
did you try to use “leave text untouched” for that article? You will need to add all the html for it yourself but it should work
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Array (PHP) in article
This does work (as Gocom already suggested):
notextile.. <txp:php>
global $film;
global $gegevens;
//Nieuwe regel op deze manier onderdaan zetten JanW
$gegevens[]="1|Test";
</txp:php>
p. rest of your article (remove the space before the p. at the beginning)
Offline
#9 2007-09-06 09:25:43
- wimmaskerdrie
- New Member
- Registered: 2007-09-04
- Posts: 5
Re: Array (PHP) in article
Ok, it works now.
Only if you use the space between notextile.. and <txp:php>
Offline
Pages: 1