Print Topic - Archive

E-Blah Community  /  Modification Archive  /  Dynamic Templates
Posted by: Justin, September 26, 2005, 9:14pm
If you want to make a "dynamic" template, here's a little bit of how you can do it.  It works and all, just everything's got to fit on one line.

Search for the following in Routines.pl:

Code
	while(<TEMP>) {
$_ =~ s/<blah v="\$(.+?)">/${$1}/gsi;


Add this after:

Code
		if($_ =~ s/<blahS (.+?)(\|(.+?))?=='(.+?)'>(.+?)<\/blahS>/<blahS$1>/) {
$change = $5;
$_ =~ s/<blahS$1>/$change/ if(${$1}{$3} eq $4 || $1 eq $4);
}


Now for how to use it.  If you want a variable like $URL{'v'} (this is the equivlent of v-{blahblah} in the URL) you'll use <blahS URL|v=='search'>{text goes here}</blahS>.  Obviously the | is for hashes.  If you just want a variable, like $v, just do <blahS v='search'>{text goes here}</blahS> ... this is pretty good if you want to make a huge banner, for instance, when someone gets a new Private Message and you don't want to edit the actual code.
Posted by: sohail, September 27, 2005, 7:32am; Reply: 1
8)very nice work hope u will share sach a nice tips and tricks and future too :o[face=Times][/face]
Posted by: 533 (Guest), October 27, 2005, 6:42pm; Reply: 2
what is the purpose of a dynamic template?
Posted by: Justin, October 27, 2005, 8:07pm; Reply: 3
You can make it so if you are on, say for instance, the search page you can display information on the search page without editing the source code.
Posted by: maxy, June 2, 2006, 8:55am; Reply: 4
can I also use it to insert some custom text in the <head> </head> of the search page ?
Posted by: Justin, June 2, 2006, 9:04am; Reply: 5
Yes.
Posted by: maxy, June 2, 2006, 9:27am; Reply: 6
can you guide me a bit that how to do it?
basically I just want to add some custom meta tags in the search/register page

Thanks
Posted by: maxy, June 3, 2006, 9:48am; Reply: 7
any help ..  ??)  ??)
Posted by: Justin, June 3, 2006, 10:24pm; Reply: 8
<blahS v=='search'>some stuff to do ...</blahS>
Posted by: maxy, June 4, 2006, 12:25am; Reply: 9
Quoted from Justin
<blahS v=='search'>some stuff to do ...</blahS>


where would I add it?
Posted by: Justin, June 5, 2006, 5:47am; Reply: 10
Wherever you want "some stuff to do" to appear ...
Posted by: maxy, June 5, 2006, 10:43am; Reply: 11
Quoted from Justin
Wherever you want "some stuff to do" to appear ...


OK I have added this code

Code

if($_ =~ s/<blahS (.+?)(\|(.+?))?=='(.+?)'>(.+?)<\/blahS>/<blahS$1>/) {
$change = $5;
$_ =~ s/<blahS$1>/$change/ if(${$1}{$3} eq $4 || $1 eq $4);
}


in the routines.pl file, now in which file and where do I add the <blahS v=='search'>some stuff to do ...</blahS>   ??

I want  "some stuff to do .." to appear in the <head> &</head> tags of the search page

Thanks
Posted by: Justin, June 5, 2006, 10:47am; Reply: 12
Add it between the head tags ...
Posted by: maxy, June 5, 2006, 12:41pm; Reply: 13
Quoted from Justin
Add it between the head tags ...


Of the main template file ?

I have done so and it isn't working, I am just seeing an extra <blahSv> in the header now
btw I am running  E-Blah Platinum 8.2
Posted by: Justin, June 5, 2006, 3:29pm; Reply: 14
View the source, and see what it's doing.
Posted by: maxy, June 6, 2006, 12:35pm; Reply: 15
I have but it isn't taking me any where ..  that is why I am asking here
Posted by: Justin, June 6, 2006, 1:14pm; Reply: 16
Does it show anything?  Are you on the search page?
Posted by: Justin, June 6, 2006, 1:16pm; Reply: 17
Change it to:

<blahS URL|v=='search'>

As it says in the first message.
Posted by: maxy, June 7, 2006, 2:02am; Reply: 18
Ok thanks it work now,
I hav added this to my main template

<blahS URL|v=='search'><META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW"></blahS>
<blahS URL|v=='pm'><META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW"></blahS>
<blahS URL|v=='recommend'><META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW"></blahS>
<blahS URL|v=='memberpanel'><META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW"></blahS>

and how I see extra

<blahSURL>
<blahSURL>
<blahSURL>
<blahSURL>

in the source of every forum page?
Posted by: Justin, June 7, 2006, 5:55am; Reply: 19
What do you mean by that last part?
Posted by: maxy, June 8, 2006, 8:08pm; Reply: 20
I mean that now when I veiw the source code of any page of the form than I see the 3 tags of <blahSURL> in it
which I think that should not be there as it should get converted to some kind of html tag or get completely removed
Posted by: Justin, June 9, 2006, 5:48am; Reply: 21
Code
if($_ =~ s/<blahS (.+?)(\|(.+?))?=='(.+?)'>(.+?)<\/blahS>/<blahS$1>/)


Code
if($_ =~ s/<blahS (.+?)(\|(.+?))?=='(.+?)'>(.+?)<\/blahS>//)
Posted by: maxy, June 10, 2006, 4:50am; Reply: 22
I have tried the replacement mentioned by you but after it the modification stops working and I also don't see the custom text in the headers?
Posted by: Justin, June 10, 2006, 9:11am; Reply: 23
Instead, change:

Code
$_ =~ s/<blahS$1>/$change/ if(${$1}{$3} eq $4 || $1 eq $4);


to

Code
$_ =~ s/<blahS$1>/$change/ if(${$1}{$3} eq $4 || $1 eq $4);

$_ =~ s/<blahS$1>//;
Posted by: maxy, June 10, 2006, 11:38pm; Reply: 24
Thanks it works now
Print page generated: November 20, 2008, 9:22am