Running a command in a php template
Posted: Wed Dec 30, 2009 8:42 am
Greetings all, my first time here on php developer network...
I'm translating and otherwise improving a German game that has all its php files encrypted, but has many open php template files.
Whenever a player joins a game, he gets a village with name $village.name, which is equivalent to $player.name + "s dorf". If his username is Aragorn, the value of $village.name is "Aragorns dorf". I need to have this variable be automatically changed to $player.name + "s village" (dorf is the german word for village).
Luckily, there is an option within the game that allows the user to change the name of his village. Here's that code (from one of the template files):
So what I'd like to do is put some code at the top of the template that checks to see if the name has "dorf" in it, and if so, changes the name to $player.name + "s village". I'm guessing I need to somehow call the game.php file with h={$player.name + "s village"}.
Suggestions?
I'm translating and otherwise improving a German game that has all its php files encrypted, but has many open php template files.
Whenever a player joins a game, he gets a village with name $village.name, which is equivalent to $player.name + "s dorf". If his username is Aragorn, the value of $village.name is "Aragorns dorf". I need to have this variable be automatically changed to $player.name + "s village" (dorf is the german word for village).
Luckily, there is an option within the game that allows the user to change the name of his village. Here's that code (from one of the template files):
Code: Select all
<form action="game.php?village={$village.id}&screen=main&action=change_name&h={$hkey}" method="post">
<table>
<tr><th colspan="3">Change village name:</th></tr>
<tr><td><input type="text" name="name" value="{$village.name}"></td><td><input type="submit" value="Change"></tr>
</table>
</form>Suggestions?