![]() |
FAQ/Help |
Calendar |
Search |
#1
|
|||
|
|||
Im looking at the pod file and im not liking the way it uses templates. so i went and found some code that gets the template, looks for a specific peice of code in it and then changes the code to what you want to output. that way you can build the template around the peice of code. anyway, im having some problems. here is the code listing that does it:
{print &loadtemplate("template.html",{ pod => print $pod_po_output})}; sub loadtemplate{my ($filename,$text,%values,$name,$value);$filename=shift;$name=shift;%values=%$name;$text="";open(IN,"<$filename") or error("Cannot open $filename : Reason $!");while(<IN>){chomp;$text.=$_;}close IN;while($text =~ m/\<\%(.*?)\%\>/gsi) {$name=$1;if (exists($values{$name})) {$value=$values{$name};}else{$value="";}$text =~ s/<\%$name\%>/$value/g;}return $text;} but im not totally sure where to put it. it now shows where the <%pod%> is on the template a 1 and before the temlate starts is the code. anyway, if anyone can help, i would be very happy!!! you can use the code for the script if you want. im not sure where i got it, but the code was open source i think. ill find out from looking at scripts on my page. thanks again if you can help! Lotas T Smartman www.lotas-smartman.net www.the-hairy-one.com |
#2
|
||||
|
||||
It would probably help if you explained which program you're using and what it is exactly you're hoping to accomplish with the new code, because from your previous post it was not at all clear. John
__________________
Don't throw away your shot. |
Reply |
|
![]() |
||||
Thread | Forum | |||
widget code | Self Injury | |||
Can't see security code | Community Feedback & Technical Support | |||
Smilie, color, etc code changes | Other Mental Health Discussion | |||
POD - how to code out 2 lines | Community Feedback & Technical Support |