Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 03 Jan 2020, 08:57
ShikiSuen's Avatar
ShikiSuen ShikiSuen is offline
 
Join Date: Nov 2019
Anyway to detect current page in template?

I want to let a template detect whether current page is "forumdisplay" or "index".
Reply With Quote
  #2  
Old 03 Jan 2020, 17:27
PinkMilk PinkMilk is offline
 
Join Date: May 2010
Real name: Milk Pink

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

Change to desired page showthread, forumdisplay etc

Last edited by PinkMilk; 04 Jan 2020 at 18:03.
Reply With Quote
  #3  
Old 04 Jan 2020, 10:16
ShikiSuen's Avatar
ShikiSuen ShikiSuen is offline
 
Join Date: Nov 2019
Originally Posted by PinkMilk View Post
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Change to desired page showthread, forumdisplay etc

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

I single-quoted the THIS_SCRIPT but looks like this renders it ineffective.

P.S.: I already tried this trick prior to creating this thread here. Wondering whether I messed up with something else. My board runs on PHP 7.4 .

------------

Update: Similar issue happens with MyBB:
https://github.com/mybb/mybb/issues/3017
https://github.com/mybb/mybb/pull/3092

Looks like some php files in the 'includes' folder needs modification to declare the "THIS_SCRIPT".
------------

Following-up: This warning can be dismissed. It won't cause template rendering error as it does not generate any similar error message in forumdisplay, index, etc. These php files already have "THIS_SCRIPT" defined. My conclusing is that the template system of vBulletin 3.8.11 needs some fix.

Solution: Editing "template.php" and add the following to "DEFINE IMPORTANT CONSTANTS":


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

Otherwise, PinkMilk's trick won't work if vBulletin 3.8.x runs on PHP 8 in the future.

Last edited by ShikiSuen; 05 Jan 2020 at 22:33.
Reply With Quote
  #4  
Old 04 Jan 2020, 11:04
lange lange is offline
 
Join Date: Apr 2003
Originally Posted by ShikiSuen View Post
Solution: Editing "template.php" and add the following to "DEFINE IMPORTANT CONSTANTS":


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Your fix works fine for me. Thank you very much !

I had the same warning in the Navbar template for the responsive style of Sultantheme :
PHP Warning: Use of undefined constant THIS_SCRIPT - assumed 'THIS_SCRIPT' (this will throw an Error in a future version of PHP) in ..../includes/adminfunctions_template.php(3959) : eval()'d code on line 525
Reply With Quote
  #5  
Old 04 Jan 2020, 18:00
PinkMilk PinkMilk is offline
 
Join Date: May 2010
Real name: Milk Pink
I'm running php 5.6.32 on my local vb version so probably can't recreate the error if you think its higher php related,

HOWEVER...
I noticed I missed the closing " (previous post fixed).


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


Last edited by PinkMilk; 04 Jan 2020 at 18:12.
Reply With Quote
Reply



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

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 17:34.

Layout Options | Width: Wide Color: