miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Specific miniBB Support Forums / Specific /  
 

How to restrict something only to homepage when used in header?

 
Author PurpleCow
Partaker
#1 | Posted: 18 Jan 2011 05:45 
Hi,

lets say, I am moving {$user_logging} to header.
How can I restrict this option to appear only in homepage (or a set of pages) and not on any other pages.
Is there is any IF condition I can use in the header template to restrict this?

Thanks

Author Paul
Lead Developer 
#2 | Posted: 18 Jan 2011 06:55 
Which header do you mean? Your own custom header of the website?

Or are you about templates/main_header.html of miniBB?

Author PurpleCow
Partaker
#3 | Posted: 18 Jan 2011 07:09 
I was referring to main_header.html of miniBB

Thanks

Author Paul
Lead Developer 
#4 | Posted: 18 Jan 2011 07:20 
I don't understand the nature of your question. This login field already appears only on the homepage of forums and not in the other headers. You don't have to move it somewhere and surround it with the extra code. It's already working that way.

Except it appears on the message reply/topic form, but it should be there. It's miniBB feature that you can login and post a message at once.

All conditions can't be build in templates. Templates contain only static content and variables, BUT variable could be build dynamically. Here's some additional topic to read.

Author Bluesplayer
Partaker
#5 | Posted: 18 Jan 2011 14:39 
I wrote some javascript for a problem similar to this. It looks at the url and if it contains any particular word it then posts certain code. It was for porn search terms initially but can be used for anything really. It worked for over 500 google banned words without any problem. When a particular porn related word was found in the url it would display a different banner. I have used it since to display or not display titles on pages by incorporating the display: none tag. The code might come in handy for some and can be seen here.

A 2 javascript setup can be used to show complete blocks of any code Bit crude using 2 javascripts but it does work well for me.

Regards

Author Paul
Lead Developer 
#6 | Posted: 19 Jan 2011 05:03 
Bluesplayer
For me it seems your code is not related to the question above at all :-) Or at least I didn't get the idea what exactly it is about...

Author Bluesplayer
Partaker
#7 | Posted: 19 Jan 2011 05:08 
Well if the design on his or her site is a bit complex with a need to show the login on only certain pages my code can be used. Pretty simple matter to put the login code inside the 2 javascript version and put the page number or whatever else is unique in the url to activate the javascript. The login box will either show or not show depending as a result.

Author Paul
Lead Developer 
#8 | Posted: 19 Jan 2011 06:23 
It's too difficult, and JavaScript should not be involved where it's possible to solve it with PHP.

Author Bluesplayer
Partaker
#9 | Posted: 19 Jan 2011 06:41 
Could come in handy for certain situations. I also wrote a php version too come to think of it. Good thing about it is you can include any number of pages to display stuff or not, or link it to search terms to display content or not just like my porn filter.

As I said it could come in handy for someone for something or other.

Specific miniBB Support Forums / Specific /
 How to restrict something only to homepage when used in header?
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Check out the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑