andre Posted October 10, 2003 Report Share Posted October 10, 2003 ir template ' <html> <!#MODULE:modulename#> <html1> <!#MODULE:menu#> <html2> <!#MODULE:document#> <html> <!#MODULE:othername#> <html> <!#MODULE:name05#> <html> ' kaa uztaisiit taa, lai apstraadaajot template rezultaats buutu taads <html> $modulename <html1> $menu <html2> $document <html> $othername <html> $name5 <html> taa lai <!#MODULE:modulename#> aizvietotoas ar mainiigo $modulename, kas tiek nemts no datu baazes $modulename=$row["modulename"]; <!#MODULE:xxx#> => $xxx=$row["xxx"]; Link to comment Share on other sites More sharing options...
Qued Posted October 10, 2003 Report Share Posted October 10, 2003 Var sākt ar str_replace, substr un strpos. Noteikti var arī ar regulārajām izteiksmēm, piemēram, ereg_replace(), bet tur ir šis tas arī jāzina par regulārajām izteiksmēm. Link to comment Share on other sites More sharing options...
cuuu Posted October 10, 2003 Report Share Posted October 10, 2003 es taa sapratu ka tabulaa tev glabaajas mainiigo nosaukumi kurus vajadzees izdrukaat jaa? piemeeram, ja tabulaa staavees "kakjis" tas noziimees, ka jaaizdrukaa mainiigaa $kakjis veertiiba? ja taa, rekur piemeers: <code><font color="#000000"> $kakjis = 'desa'; $vaards = 'kakjis'; echo( $$vaards); //izdrukaa 'desa' </font> </code> nu tev tur gan jau ka buus kaut kaads cikls, lai apstiitu visas taas modulename veertiibas <code><font color="#000000"> $saturs = 'visa taa garaa pentere kuru jaapaartaisa'; while ($row = mysql_fetch_array($mysql_rez)) $saturs = preg_replace('/<!#MODULE:'.$row['modulename'].'#>/', ${$row['modulename']}, $saturs); echo($saturs); </font> </code> Link to comment Share on other sites More sharing options...
andre Posted October 11, 2003 Author Report Share Posted October 11, 2003 vai kaads nevareetu siikaak pastaatsiit par preg_replace nosaciijumiem.... ??????? Link to comment Share on other sites More sharing options...
Roze Posted October 12, 2003 Report Share Posted October 12, 2003 Par regular expressions (taa ir taa lieta ar ko preg_replace un preg_match utt nodarbojas) raksta graamatas (piem: http://www.oreilly.com/catalog/regex/ ) :) Liidz ar to cereet ka kaads tagad njems un ieblieziis forumaa to visu diezvai var gaidiit.. Vienkaarshaakais veids google.. http://www.phpbuilder.com/columns/dario19990616.php3 http://sitescooper.org/tao_regexps.html http://etext.lib.virginia.edu/helpsheets/regex.html Link to comment Share on other sites More sharing options...
Recommended Posts