Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
Merge into $show
Michael Morris
Join Date: Nov 2003
Posts: 774

Employee of Digital Media Graphix of Knoxville TN, currently developing a new framework / CMS

Knoxville TN
by Michael Morris Michael Morris is offline 30 Oct 2004

Hello everyone - here's a quick tip: I'm fond of giving my users a lot of controllable options using user profile fields and then using the phpinclude start template to express those as $show conditionals. I do this because it makes the resultant stylesheets more portable - the user profile field in the $bbuserinfo almost certainly will change from server to server - and if you refer to the same condition multiple times it becomes a pain in the tail to move the style to a new setup.

So I move the $bbuserinfo['fieldX'] stuff over to $show. The reason is that, like $bbuserinfo, $show is declared global in almost every function that deals with data display (the sole exception I know of is the function that parses subforums). You can also choose names for your show variables that are descriptive, which in turn makes your code easier for others to read.

Initialize your custom $show variables in your phpinclude_start template like so...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

And so on. After you initialize them, you can then assign their values. Changing the $bbuserinfo over into them - that's a lesson for another time (this is supposed to be a "quick tip")

Last edited by Xenon; 30 Oct 2004 at 14:04.. Reason: closing tag was missing
Views: 2097
Reply With Quote
Comments
  #2  
Old 30 Oct 2004, 11:31
Brad Brad is offline
 
Join Date: Nov 2001
I do this to, but as so to prevent some mess:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Also everyone should be aware that array_merge changed in php version 5:

From php.net comments

As you know, guys, because of fixing bug #25494, starting from PHP 5.0.0 Beta2 the function doesn't accept scalar values as secondary arguments. It means if you try to run <? array_merge(array('array'),'scalar'); ?> the function throws a warning and returns <? NULL ?> instead of <? array(0=>'array',1=>'scalar');?>. If you want the old behavior of the merge function, use this instead:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Good stuff Michael.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 20:52.

Layout Options | Width: Wide Color: