Welcome, Guest. Please Login or Register.
April 19, 2024, 07:10:33 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  New Subs.php functionality « previous next »
Pages: [1] Reply Ignore Print
Author Topic: New Subs.php functionality  (Read 57538 times)
Joseph Fung
Global Moderator
YaBB God
*****
Posts: 4512


Keep smiling: it makes others nervous.

WWW
New Subs.php functionality
« on: December 20, 2001, 04:30:27 PM »
Reply with quote

Ok for all you mod writers who wanted a more powerful way to create new <yabb tag> tags.

Now, in subs.php, if you create a function yyMyFunction()  [Note: it myst start with yy] and you create a yabb tag in your template <yabb MyFunction> the header and footer functions will replace the <yabb MyFunction> tag with the output of your function.

There are several benefits to this.

Right now, to create a new tag, you have todo your porcessing, and store the results in a variable $yyMyFunction - the problem with that, is $yyMyFunction will be processed ALL THE TIME - which makes it difficult to write conditional tags, or tags which require a lot of processing.

It also allows for more modular programming, as you shouldn't have to touch the template_header or footer functions in subs.php for your mods

A final note is that the function captures the output of your program - not the return value.  So all you need to do is print or echo what you want to display - and it'll be captured and inserted at the right spot.

I'll post some examples later.
« Last Edit: December 20, 2001, 04:31:40 PM by Zef Hemel » Logged

Larry_Laffer
Jr. Member
**
Posts: 82


I love YaBB SE!

ICQ - 5459459 WWW
Re:New Subs.php functionality
« Reply #1 on: December 27, 2001, 02:28:22 PM »
Reply with quote

Great. I made a LastReviews Extension at my board http://www.comicfan.de/forum

Now the last three reviews of my Nuke Portal are always displayed.

Do you have a list of all $public Variables? I would like to know in WHICH forum my function is called, because I do not want to display it in EACH forum.

But this yabb TAG thing is great!  :D ::) ;D
Logged

YaBB SE is the best BB System I know. Let's integrate it into PHPNUKE!!!!!!!
P2D
Noobie
*
Posts: 39


I'm not a llama!

zstealer@msn.com WWW
Re:New Subs.php functionality
« Reply #2 on: April 24, 2002, 06:02:51 PM »
Reply with quote

Yea very useful thing.
Logged
tOAsD
Noobie
*
Posts: 1


I'm a tOAsD!

Re:New Subs.php functionality
« Reply #3 on: June 21, 2002, 09:24:23 PM »
Reply with quote

you dont even have to create a function if you don't need too complicate tag replacement.

eg i included some <yabb x> style variables, so i could use imagemaps instead of <yabb menu>

here's the code if you are interested :)


// <tOAsD> added: <yabb menulink_x> style template addon, to have links for what normally is in <yabb menu>
// useful eg. for imagemaps ..
   $yymenulink_home="$scripturl";
   $yymenulink_help="$helpfile";
   $yymenulink_search="$cgi;action=search";
   $yymenulink_admin=($settings[7] == 'Administrator')?"$cgi;action=admin":"javascript:alert('you have no administrative rights.);";
   $yymenulink_gmod=($settings[7] == 'Global Moderator')?"$cgi;action=gmod":"javascript:alert(you are not a global moderator.');";
   $yymenulink_login=($username=="Guest")?"$cgi;action=login":"javascript:alert('you are already logged in.');";
   $yymenulink_register=($username=="Guest")?"$cgi;action=register":"javascript:alert('you already have registered.');";
   $yymenulink_profile=($username!="Guest" && $username)?"$cgi;action=profile;user=".urlencode($username):"javascript:alert('you are not logged in / registered');";
   $yymenulink_notification=($enable_notification)?"$cgi;action=shownotify":"javascript:alert('notifications are disabled.');";
// /<tOAsD>

insert this in Subs.php before the line
$yymenu = "<a href=\"$scripturl\">$img[home]</a>$menusep<a href=\"$helpfile\" target=_blank>$img[help]</a>$menusep<a href=\"$cgi;action=search\">$img[search]</a>";

the usage should be kind of self-explanatory, if you dont get the clue, here is one example...

<yabb menulink_help> in your template.php will be replaced by the url to your helpfile ...

/tOAsD
Logged
groundup
Disciple of Joe, Head Cleric
Mod Team
YaBB God
*****
Posts: 2983


Error 309: Please notify the administrator of this

WWW
Re:New Subs.php functionality
« Reply #4 on: June 24, 2002, 06:39:45 AM »
Reply with quote

Quote from: Joseph Fung on December 20, 2001, 04:30:27 PMI'll post some examples later.

lmao.. it's June 24, 2002.  Still waiting......
Logged

http://www.fastfinancialfreedom.org - financial freedom is a myth
http://www.fastfinancialfreedom.org - financial freedom is a myth
http://www.fastfinancialfreedom.org - financial freedom is a myth
fastfinancialfreedom.org
David
Destroyer Dave
Global Moderator
YaBB God
*****
Posts: 5761


I'm not a llama!

WWW
Re:New Subs.php functionality
« Reply #5 on: June 24, 2002, 07:02:29 AM »
Reply with quote

Quote from: groundup on June 24, 2002, 06:39:45 AM
Quote from: Joseph Fung on December 20, 2001, 04:30:27 PMI'll post some examples later.

lmao.. it's June 24, 2002.  Still waiting......
lmao, it is very simple to make work.
Logged

groundup
Disciple of Joe, Head Cleric
Mod Team
YaBB God
*****
Posts: 2983


Error 309: Please notify the administrator of this

WWW
Re:New Subs.php functionality
« Reply #6 on: June 24, 2002, 06:51:57 PM »
Reply with quote

twas a joke
Logged

http://www.fastfinancialfreedom.org - financial freedom is a myth
http://www.fastfinancialfreedom.org - financial freedom is a myth
http://www.fastfinancialfreedom.org - financial freedom is a myth
fastfinancialfreedom.org
Jedi~
Eric
Beta Tester
YaBB God
*****
Posts: 1284


WWW
Re:New Subs.php functionality
« Reply #7 on: June 26, 2002, 03:37:58 AM »
Reply with quote

*sigh* What am I going to do with you 2? I think I'll hand you over to Andy to deal with :P ;)
Logged
groundup
Disciple of Joe, Head Cleric
Mod Team
YaBB God
*****
Posts: 2983


Error 309: Please notify the administrator of this

WWW
Re:New Subs.php functionality
« Reply #8 on: July 12, 2002, 05:38:29 AM »
Reply with quote

i understand this up until the point about the variable.  Where does this variable have to be declared?  Can I have other variables inside of my function?  Can I have them printed?  Anything else I should know?
Logged

http://www.fastfinancialfreedom.org - financial freedom is a myth
http://www.fastfinancialfreedom.org - financial freedom is a myth
http://www.fastfinancialfreedom.org - financial freedom is a myth
fastfinancialfreedom.org
Spaceman-Spiff
Mod Team
YaBB God
*****
Posts: 3689


My $txt[228]

Re:New Subs.php functionality
« Reply #9 on: October 25, 2002, 08:29:06 PM »
Reply with quote

this function is really great :)

to use it:
in template.php put something like:
<yabb printCoolBanner>

then anywhere in your script, example in Subs.php, write:
function yyprintCoolBanner() {
   echo "<img scr=\"coolbanner.gif\" />";
   #do other cool stuffs here;
}
Logged

   My mods, ysePak, codes, tutorials
    Support question IMs = bad.
adams
Jr. Member
**
Posts: 80


http://outersurf.com http://jadz.com

WWW
Re:New Subs.php functionality
« Reply #10 on: November 21, 2002, 06:33:04 PM »
Reply with quote

Is this the best/fastest way to include php variables in my template? I have embedded YaBBSE into a squirrelmail ( http://squirrelmail.org ) installation. This gives my webmail users a online community.

The webmail interface stores the users preferred colours in variables such as $color[9] that I would like to use when producing the YaBBSE index.php to give a uniform look.

I know that I could use <yabb color9> tag but is there a faster way to include php in my template without having to call a function?
Logged

Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:New Subs.php functionality
« Reply #11 on: July 10, 2003, 04:15:31 PM »
Reply with quote

would include() work inside the yabbse functions? like:

function yyNavMenu() {
include(navigation.php);
}

I know it may sound a silly question, but since the navigation.php file will have characters that should be escaped if echoed, I don't know if it'd work properly...
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:New Subs.php functionality
« Reply #12 on: July 10, 2003, 06:44:32 PM »
Reply with quote

Yes, of course.

-[Unknown]
Logged
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:New Subs.php functionality
« Reply #13 on: July 10, 2003, 10:56:18 PM »
Reply with quote

great!!

I always escape espaping if possible when it's a lot of code ;D

offtopic: is there an editor with a tool to escape symbols in code? you know, like the one to convert unusual characters to it's html equivalent, it'd be nice if you could just select a bunch of code lines and click the "escape" button hehe
« Last Edit: July 10, 2003, 11:00:41 PM by Anguz » Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  New Subs.php functionality « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.047 seconds with 20 queries.