Page Index Toggle Pages: 1 [2] 
Topic Tools
Hot Topic (More than 10 Replies) Adding Global Vars - How do I? (Read 4,070 times)
Lopa
Junior Member
**
Offline



Posts: 95
Location: Australia
Re: Adding Global Vars - How do I?
Reply #4 - Sep 27th, 2010 at 11:59pm
Post Tools
Thanks Derek,

Derek Barnstorm wrote on Sep 27th, 2010 at 1:35pm:
Told you I wasn't an expert.


That's two of us!  Wink

"yabb images" VAR appears to always take me to the "default" folder - which is not much use really for what I'm trying to do.  Cry

But if CJ wants to get on board and give me an argument that "Knows" what theme is being used - Then I'm nearly there.
Smiley
  

I make mistakes - That's how I learn.
Back to top
WWW  
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Adding Global Vars - How do I?
Reply #3 - Sep 27th, 2010 at 1:35pm
Post Tools
Told you I wasn't an expert. Cheesy

Sorry, I didn't check the images, I assumed it would pick them up.

Anyhow, using the {yabb images} tag which is already there seems to do the trick. So instead of this:

Code (Perl)
Select All
$imagesdir/vista/tbl_top_r.png 


Try this:

Code (Perl)
Select All
{yabb images}/tbl_top_r.png 


Again though, I have only tested quickly...
  
Back to top
 
IP Logged
 
Lopa
Junior Member
**
Offline



Posts: 95
Location: Australia
Re: Adding Global Vars - How do I?
Reply #2 - Sep 27th, 2010 at 11:51am
Post Tools
Thanks Derek,

You're spot on and possibly saved me about 24 hrs of reading this stuff trying to find out what goes where.  Wink

Got another problem you may want to try to help with - and here it is ->  Undecided

Here's how I ended up doing the tables as I found out that  $imagedir wasn't going to work in the original:

Code
Select All
$imagepath = "$yyhtml_root/Templates/Forum";
$imgextg = "gif\" alt=\"\" border=\"0\"";
$imgextp = "png\" alt=\"\" border=\"0\"";

$yytbl_top_l = qq~<img src="$imagepath/default/vista/tbl_top_l.$imgextp" />~;
$yytbl_top_r = qq~<img src="$imagepath/default/vista/tbl_top_r.$imgextp" />~;
$yytbl_f_l = qq~<img src="$imagepath/default/vista/tbl_f_l.$imgextp" />~;
$yytbl_f_r = qq~<img src="$imagepath/default/vista/tbl_f_r.$imgextp" />~;

$yyvistatop = qq~<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center"><tr><td align="right" width="11">{yabb tbl_top_l}</td><td class="tbl_top_c" width="100%"></td><td width="11" align="left">{yabb tbl_top_r}</td></tr><tr><td class="tbl_l_s" width="11"></td><td>~;

$yyvistabottom = qq~</td><td class="tbl_r_s" width="11"></td></tr><tr><td width="11">{yabb tbl_f_l}</td><td class="tbl_f_c"></td><td width="11">{yabb tbl_f_r}</td></tr></table>~;
1;
 



And that works sweet - as you can see here ->
http://members.iinet.net.au/~cranky65/cgi-bin/forum/YaBB.pl

But! I'm running two themes and while I want to use the same VARS, I also need to separate them as in "default" and "blue".

Ok, so I tried splitting the request with:

Code
Select All
if (-e "$yyhtml_root/Templates/Forum/default_vista.css")
{
Do this etc!
}

And

if (-e "$yyhtml_root/Templates/Forum/blue_vista.css")
{
Do this etc!
} 



But I don't think "filecheck" works outside of the cgi-bin?

So I went another way - - - darn it! I'll go table-less and let the .css look after it with:

Code
Select All
$yyvistatop = qq~<div class="t"><div class="b"><div class="l"><div class="r"><div class="bl"><div class="br"><div class="tl"><div class="tr">~;

$yyvistabottom = qq~</div></div></div></div></div></div></div></div>~;

and the CSS:

.t {background: url(./default/vista/vista_top_c.png) 0 0 repeat-x;}
.b {background: url(./default/vista/vista_bot_c.png) 0 100% repeat-x;}
.l {background: url(./default/vista/vista_l_s.png) 0 0 repeat-y;}
.r {background: url(./default/vista/vista_r_s.png) 100% 0 repeat-y;}
.bl {background: url(./default/vista/vista_bot_l.png) 0 100% no-repeat;}
.br {background: url(./default/vista/vista_bot_r.png) 100% 100% no-repeat;}
.tl {background: url(./default/vista/vista_top_l.png) 0 0 no-repeat;}
.tr {background: url(./default/vista/vista_top_r.png) 100% 0 no-repeat; padding:11px;}
 



YaBB DIDN'T LIKE IT!  because it conflicts with some other div placements and tables - darn! Angry

So I need to create a valid argument that either checks for a file outside of cgi-bin or a checkable $var statement of some sort that knows what theme file is in current use?

It's been a long day - - - And don't be like me! - - Make sure you have some breakfast before you start answering this!  Grin Grin Grin
« Last Edit: Sep 27th, 2010 at 12:13pm by Lopa »  

I make mistakes - That's how I learn.
Back to top
WWW  
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Adding Global Vars - How do I?
Reply #1 - Sep 26th, 2010 at 4:16pm
Post Tools
Hi,

I'm certainly no expert here and I've only given this a quick test, but this should do what you want...

I've attached Custom_Vars.pl to this post (Note, you'll have to change the .txt extension back to .pl) - Upload it to the Sources directory.

You can basically make a global tag like this:

Code (Perl)
Select All
$yytestvar = qq~This is a test~; 


Which will give you this tag: {yabb testvar}.

Anyway, I've added the tags that you wanted as a quick example - it is very simple so you should see how it works.

Then, in YaBB.pl find this line:

Code (Perl)
Select All
	require "$sourcedir/Load.pl"; 


And add after:

Code (Perl)
Select All
	require "$sourcedir/Custom_Vars.pl"; 


And you should be good to go...
« Last Edit: Sep 26th, 2010 at 4:17pm by Derek Barnstorm »  

Custom_Vars.txt ( 1 KB | 100 Downloads )
Back to top
 
IP Logged
 
Lopa
Junior Member
**
Offline



Posts: 95
Location: Australia
Adding Global Vars - How do I?
Sep 26th, 2010 at 5:54am
Post Tools
I'm back again! with an earnest request?

Is there a way to globalise variables so that one doesn't have to crawl through every template.pl and add variables to the different sections that affect all the different templates?

I've been playing with Display.pl and Display Template with this:

Code (Perl)
Select All
$template_vistatop = qq~<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center"><tr><td align="right" width="11"><img src="$imagesdir/vista/tbl_top_l.png" width="11" alt="" /></td><td class="tbl_top_c" width="100%"></td><td width="11" align="left"><img src="$imagesdir/vista/tbl_top_r.png" width="11" alt="" /></td></tr><tr><td class="tbl_l_s" width="11"></td><td>~;
$display_template =~ s/({|<)yabb vistatop(}|>)/$template_vistatop/g;
$display_template =~ s/({|<)yabb vistatop(}|>)/$template_vistatop/g;

$template_vistabottom = qq~</td><td class="tbl_r_s" width="11"></td></tr><tr><td width="11"><img src="$imagesdir/vista/tbl_f_l.png" width="11" height="10" alt="" /></td><td class="tbl_f_c"></td><td width="11"><img src="$imagesdir/vista/tbl_f_r.png" width="11" height="10" alt="" /></td></tr></table>~;
$display_template =~ s/({|<)yabb vistabottom(}|>)/$template_vistabottom/g;
$display_template =~ s/({|<)yabb vistabottom(}|>)/$template_vistabottom/g; 



As I'd like to modify all the templates by simply using {yabb vistatop} etc as I've found that one has to add the var to different sections of single .pl files for it to work. And that's a LOT of work!


If yes it can be done - I'd also like to know how to include and use a "Custom_Vars.pl" for adding the mark up to the templates as it makes it so much easier to create new themes.

Danke!
Grazzie!
Thanks!
Obsobosoloy!
Cheers!

« Last Edit: Sep 26th, 2010 at 9:54am by Lopa »  

I make mistakes - That's how I learn.
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Topic Tools
 
  « Board Index ‹ Board  ^Top