Re-ordering contents of a file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Monotoko
Forum Commoner
Posts: 64
Joined: Fri Oct 26, 2007 4:24 pm

Re-ordering contents of a file

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Re-ordering contents of a file

Post 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.
Monotoko
Forum Commoner
Posts: 64
Joined: Fri Oct 26, 2007 4:24 pm

Re: Re-ordering contents of a file

Post 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?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Re-ordering contents of a file

Post 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?
Post Reply