TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-01-2011, 09:24 PM   #1 (permalink)
The Wanderer
 
Join Date: May 2010
Posts: 7
Thanks: 0
Torsten is on a distinguished road
Default Parse error: syntax error, unexpected T_ECHO in -> regexp code on line 1

Code:
Parse error: syntax error, unexpected T_ECHO in D:\Webserver\Projekte\de.unique.labs.tests\Template System\class\extensions\extensionArrayParse.php(8) : regexp code on line 1

Fatal error: preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Failed evaluating code: echo 'testArray' in D:\Webserver\Projekte\de.unique.labs.tests\Template System\class\extensions\extensionArrayParse.php on line 8
The Code Parse is

Code:
while( preg_match( "/" .$this->leftDelimiterF ."loop name=\"(.*)\"".$this->rightDelimiterF ."/isUe", $this->template)){
			$this->template = preg_replace( "/" .$this->leftDelimiterF ."loop name=\"(.*)\""						.$this->rightDelimiterF."/isUe",
				"echo '\\1'",
				$this->template );
			
}
Could someone help me I don't find the mistake
__________________
Sorry for my Bad English xD Iam german ^^
Torsten is offline  
Reply With Quote
Old 02-01-2011, 11:08 PM   #2 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

it says that the problem is at echo 'testArray' but I don't see any of that in the code you provided.
tony is offline  
Reply With Quote
Old 02-02-2011, 02:28 PM   #3 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

The problem is you have given the regex the 'e' modifier, which means evaluate the replacement as php code.

Do you really need to do this? What are you trying to do?
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Old 02-03-2011, 02:08 PM   #4 (permalink)
The Wanderer
 
Join Date: May 2010
Posts: 7
Thanks: 0
Torsten is on a distinguished road
Default

Iam Trying to develope my own Template System. But I stuck with the {loop Syntax for a Array.

Could someone help me there?

Array
Code:
$array = array('0' => array('userName' => 'Tester','userID' => '1','groupID' => '1','groupName' => 'Admin'),'1' => array('userName' => 'Tester2','userID' => '2','groupID' => '2','groupName' => 'Miglied'));
$tpl->assign('testArray',$array);

Template Code
Code:
<div>
{loop name="testArray"}
 <p>{$value.userName}</p>
{/loop}
</div>
There should be displayed in the Template
<div>
<p>Tester</p>
<p>Tester2</p>
</div>
__________________
Sorry for my Bad English xD Iam german ^^
Torsten is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Parse error: parse error,syntex error unexpected ',' expectingT_STRING in my code tech Absolute Beginners 13 01-29-2013 10:00 AM
Match code in link with code with one in file and extract line Peuplarchie General 0 10-23-2009 02:38 PM
help on making my own crawler webtuto General 16 08-08-2009 08:55 AM
Game: Let's Develop Something Crazy! Wildhoney The Lounge 25 05-23-2009 09:18 PM
how to parse source code of a webpage sarmenhb General 10 11-06-2008 05:19 PM


All times are GMT. The time now is 04:29 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design