Reply to How to call a class function from XML

Your name:

Reply:


Posted by salmobytes on 10/03/07 19:44

Let's say I have some XML that looks vaguely like:

<template>
<div id="displayDivOne" src="mkNav()" />
......etc.
</template>

I want to use the div line to call a class function, I.E. $this-
>mkNav();
without creating a hard-coded switch statement.

.....I'd like to say something like:
$cnt=0;
foreach ($xml->xpath("/template/div") as $adiv)
{
$this->divs[$cnt] = '<div id="'.$adiv[@id].'">';
$myfunc = $adiv[@src];

$this->divs[$cnt] .= $myfunc;
.....or maybe something like:
eval ("$this->divs[$cnt] .= $myfunc");

$this->divs[$cnt] .= '</div>';
$cnt++;
}

....but of course none of the above works.
I don't want to have to remember to modify a switch
statement every time I add a new function to the class,
that might end up specified in the XML.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация