Page 1 of 1

Re-ordering contents of a file

Posted: Sat Nov 21, 2009 1:43 pm
by Monotoko
Hiya...having a little problem here and was wondering if one of you would mind pointing me in the right direction...

lets say i have a PHP file (template, i know it wouldnt work in its current state) with the following (simplified version of the templates im trying to make this work with)

Code: Select all

 
<?php
%header%
 
%start_text%
%video%
%rssfeed%
 
%footer%
?>
I can replace the % values with what they should be when the editing has finished using str_replace()

but what if the user doesnt want them in that order? what if they want to switch %video% and %rssfeed% around?

How would i go about giving the user the option to edit those?

~Daniel

Re: Re-ordering contents of a file

Posted: Sat Nov 21, 2009 3:12 pm
by requinix
Give them the ability to edit the template file... which is horribly insecure because they could put arbitrary PHP code in there.

How about the ability to rearrange them? There's those five tokens: let the user specify the order.

Re: Re-ordering contents of a file

Posted: Sat Nov 21, 2009 3:21 pm
by Monotoko
Well this application will be installed on there server...so its up to them what they do with it, arbitrary PHP code would only affect there own server...

but ideally, i want this to be as simple as possible for the user, as the majority of them will not know a thing about coding, so i dont want them seeing the PHP code in the applucation....

So i was wondering if it was possible to display a change order PHP file, which loads up the template, then tells the user what order there in with a small text box at the side saying a number....they change the number, it changes the order?

Re: Re-ordering contents of a file

Posted: Sat Nov 21, 2009 3:58 pm
by josh
tasairis wrote:they could put arbitrary PHP code in there.
It would be escaped because he is not using include() or exec().
And I don't understand why they can't edit the template?