Looking for new php developer and beta testers to join team

Post any non code related PHP problems here.

Re: Looking for new php developer and beta testers to join team

Postby wide_load » Wed Mar 03, 2010 6:19 pm

phpkid wrote:Yes i did But i Dont Know The PHP functions Very Well so i what i mean is:

How Do i Use the PHP function :eval() and preg_match_all()?


eval executes a string as if it is php code.

and preg_match_all() will match everything that matches the regular expression provided.

you can look at the php.net pages for both functions to view some example useage.
Image
User avatar
wide_load
Top Contributor
 
Posts: 5617
Joined: Thu Aug 13, 2009 1:04 pm
Online: 13d 22h 11m 40s
Karma: 45

Re: Re: Looking for new php developer and beta testers to join team

Advertisment

Advertisment
 

Re: Looking for new php developer and beta testers to join team

Postby phpkid » Wed Mar 03, 2010 7:35 pm

ive got the basic Consept :) i currently have:

[php]
public function output() {

if (!file_exists($this->file)) {
return "Error loading template file ($this->file).<br />";
}
$output = file_get_contents($this->file);

foreach ($this->values as $key => $value) {
$left_delimiter = '<[';
$right_delimiter = ']>';
$search = '/\{php\}(.*?)\{\/php\}/is';
$replace = '<?php $1 ?>';
$tagToReplace = $left_delimiter.$key.$right_delimiter;
$output = str_replace($tagToReplace, $value, $output);
$output = preg_replace($search,$replace, $output);
}

return $output;
}
[/php]

but i have a problem, 2 $outputs isnt what i want so i need to really do two str_replace()'s

ive tried
str_replace()&&str_replace();

But it dont work :/

any other Methods?

phpkid
phpkid
 
Posts: 234
Joined: Sat Aug 22, 2009 2:29 pm
Online: 58m 56s
Karma: 0

Re: Looking for new php developer and beta testers to join team

Postby wide_load » Wed Mar 03, 2010 9:15 pm

phpkid wrote:ive got the basic Consept :) i currently have:

[php]
public function output() {

if (!file_exists($this->file)) {
return "Error loading template file ($this->file).<br />";
}
$output = file_get_contents($this->file);

foreach ($this->values as $key => $value) {
$left_delimiter = '<[';
$right_delimiter = ']>';
$search = '/\{php\}(.*?)\{\/php\}/is';
$replace = '<?php $1 ?>';
$tagToReplace = $left_delimiter.$key.$right_delimiter;
$output = str_replace($tagToReplace, $value, $output);
$output = preg_replace($search,$replace, $output);
}

return $output;
}
[/php]

but i have a problem, 2 $outputs isnt what i want so i need to really do two str_replace()'s

ive tried
str_replace()&&str_replace();


But it dont work :/

any other Methods?

phpkid


i think
[php]str_replace();
str_replace();[/php]

would be the obvious thing to do first.

but you should not need to str_replace anything.

you seem to be trying to replace {php} and {/php} with <?php and ?> which is the wrong approach

ill post an example of what i meant in about 10 minutes when i have worked it out completly and you can try to understand it and work it into your code.
Image
User avatar
wide_load
Top Contributor
 
Posts: 5617
Joined: Thu Aug 13, 2009 1:04 pm
Online: 13d 22h 11m 40s
Karma: 45

Re: Looking for new php developer and beta testers to join team

Postby wide_load » Wed Mar 03, 2010 9:39 pm

this is the test file i used

{php}

$i = 0;
while ($i < 10){
   echo "yes ";
   $i++;
}

{/php}
<br />
<br />
some html
{php} echo $variable; {/php}


and this is the php that processes the bits in the php tags
[php]<?php

$variable = 'hmm';

$temp = file_get_contents('template.txt');

$phpblocks = array();
preg_match_all('/\{php\}(.*?)\{\/php\}/s', $temp, $phpblocks);

foreach ($phpblocks[1] as $php){
echo eval($php);
}

?>[/php]

be careful using this method, read up on why eval is bad first.
Image
User avatar
wide_load
Top Contributor
 
Posts: 5617
Joined: Thu Aug 13, 2009 1:04 pm
Online: 13d 22h 11m 40s
Karma: 45

Re: Looking for new php developer and beta testers to join team

Postby bowersbros » Wed Mar 03, 2010 9:43 pm

aha. irony.

eval == evil :p
The early bird catches the worm but the second mouse gets the cheese!

If you look like your passport picture, you probably need the trip.

---

IM contact details:
Example doesnt work, requires a href
bowersbros
Top Contributor
 
Posts: 2019
Joined: Tue Apr 21, 2009 7:55 pm
Location: United Kingdom
Online: 4d 10h 49m 56s
Karma: 6

Re: Looking for new php developer and beta testers to join team

Postby phpkid » Wed Mar 03, 2010 11:02 pm

I Hate PHP sometimes :twisted: it gets so Complicated.

lol ok thanks il work on it :D il post with Results.

phpkid
phpkid
 
Posts: 234
Joined: Sat Aug 22, 2009 2:29 pm
Online: 58m 56s
Karma: 0

Re: Looking for new php developer and beta testers to join team

Postby wide_load » Wed Mar 03, 2010 11:49 pm

phpkid wrote:I Hate PHP sometimes :twisted: it gets so Complicated.

lol ok thanks il work on it :D il post with Results.

phpkid


that's why i like it :)

I cant think of a way to do this without using eval... ?
Image
User avatar
wide_load
Top Contributor
 
Posts: 5617
Joined: Thu Aug 13, 2009 1:04 pm
Online: 13d 22h 11m 40s
Karma: 45

Re: Looking for new php developer and beta testers to join team

Postby phpkid » Sun Mar 07, 2010 12:23 am

yea :/
phpkid
 
Posts: 234
Joined: Sat Aug 22, 2009 2:29 pm
Online: 58m 56s
Karma: 0

Re: Looking for new php developer and beta testers to join team

Postby wide_load » Thu Mar 18, 2010 6:44 pm

you haven't fixed any of the bugs i sent you ...

problem 3 from my PM foe example is still there http://www.surf-cms.co.uk/
Image
User avatar
wide_load
Top Contributor
 
Posts: 5617
Joined: Thu Aug 13, 2009 1:04 pm
Online: 13d 22h 11m 40s
Karma: 45

Re: Looking for new php developer and beta testers to join team

Postby phpkid » Sat Mar 20, 2010 8:23 pm

we have fixed alot of bugs that you sent us. Problem 3 Is still being Fixed Also may i ask why there is so many people registering with Admin, and wide :S lol i think your trying to get admin right with a script you made but aint working :S i dno Please Reply?

Also The Usernames Have Been Deleted.
phpkid
 
Posts: 234
Joined: Sat Aug 22, 2009 2:29 pm
Online: 58m 56s
Karma: 0

PreviousNext

Return to PHP Other

Who's online?

Users browsing this forum: No registered users and 1 guest