vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need Conditional (https://vborg.vbsupport.ru/showthread.php?t=184703)

DieselMinded 07-08-2008 11:34 AM

Need Conditional
 
I need a conditional for if this style id

Dismounted 07-08-2008 11:48 AM

STYLEID (the constant)

DieselMinded 07-08-2008 05:28 PM

Whats that Conditional look like for templates ?

--------------- Added [DATE]1215542138[/DATE] at [TIME]1215542138[/TIME] ---------------

How do i prevent certain mods from showing up on certain styles when theres nothing in the templetes to remove or Block ?

sockwater 07-08-2008 06:00 PM

Code:

<if condition="$styleid == 3">show something here to style #3</if>
This will not work in templates that are evaluated in any scope other than the global scope unless $styleid is available in that scope.

MoT3rror 07-08-2008 08:07 PM

That if condition will always return true.

Code:

<if condition="STYLEID == 3">style 3</if>

Dismounted 07-09-2008 04:57 AM

Quote:

Originally Posted by sockwater (Post 1570266)
Code:

<if condition="$styleid = 3">show something here to style #3</if>
This will not work in templates that are evaluated in any scope other than the global scope unless $styleid is available in that scope.

As I've said, you can use the constant, STYLEID. Constants are not affected by scope. A implementation is demonstrated above this post by MoT3rror.

DieselMinded 07-09-2008 11:15 PM

I just want to be able to edit all the fancys out of my Default Template to make a light weight version , Signatures is gone , Avatars are gone , ect...ect... But i have some things like Album photos on Forum home that dont have no code in the forum home template of my light weight style but is still showing on it , how do i have the mod not show on styleid5 ? , even if i knew the conditional at this point it wouldnt do me much good as i dont know how to edit auto templete mods to exclude items with a style id conditional UGH!

Dismounted 07-10-2008 05:12 AM

You'll have to find the plugin where the template edit occurs and then wrap it with the conditional.

DieselMinded 07-10-2008 07:48 AM

cache_templates =

Code:


if (THIS_SCRIPT == "index")
{
global $globaltemplates;
$globaltemplates[] = 'afm_latestfm';
$globaltemplates[] = 'afm_picture';
}

forum home start

Code:

if (
        (
                $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums']
                AND
                $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers']
                AND
                $permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum']
                AND
                $vbulletin->options['afm_onoff']
        )
)
{
  $displayrecords = ($vbulletin->options['afm_sayi'] ? $vbulletin->options['afm_sayi'] : 4);
    switch ($vbulletin->options['afm_dt'])
    {
      case 1: $sorgu = "ORDER BY dateline DESC LIMIT 0, $displayrecords"; break;
      case 2: $sorgu = "ORDER BY rand(NOW()) DESC LIMIT 0, $displayrecords"; break;
    } 
  $lpictures = $db->query("
  SELECT albumpicture.*, album.*, user.username, user.usergroupid,
  IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
  FROM " . TABLE_PREFIX . "albumpicture AS albumpicture
  LEFT JOIN " . TABLE_PREFIX . "album AS album ON(album.albumid = albumpicture.albumid)
  LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = album.userid)
  WHERE album.state = 'public'
  $sorgu 
  ");
  if ($db->num_rows($lpictures))
  {
        while ($lpicture = $db->fetch_array($lpictures))
        {
        $lpicture['musername'] = fetch_musername($lpicture);
        $lpicture['title'] = trim(strip_quotes($lpicture['title']));
        eval('$resimler .= "' . fetch_template('afm_picture') . '";');
        }
    switch ($vbulletin->options['afm_yer'])
    {
      case 1: $vbulletin->templatecache['navbar'] .= $vbulletin->templatecache['afm_latestfm']; break;
      case 2: $vbulletin->templatecache['FORUMHOME'] = str_replace('<!-- main -->', '<!-- what\'s going on box -->'.$vbulletin->templatecache['afm_latestfm'], $vbulletin->templatecache['FORUMHOME']); break;
      case 3: $vbulletin->templatecache['FORUMHOME'] = str_replace('<!-- what\'s going on box -->', '<!-- end what\'s going on box -->'.$vbulletin->templatecache['afm_latestfm'], $vbulletin->templatecache['FORUMHOME']); break;
      case 4: $vbulletin->templatecache['FORUMHOME'] = str_replace('<!-- end what\'s going on box -->', '<!-- end what\'s going on box -->'.$vbulletin->templatecache['afm_latestfm'], $vbulletin->templatecache['FORUMHOME']); break;
    }
  }
  $db->free_result($lpictures);
}

Where do i put the conditional ... Show me once and ill know for everything else

thanks

Dismounted 07-10-2008 09:21 AM

Find:
PHP Code:

    switch ($vbulletin->options['afm_yer'])
    {
      case 
1$vbulletin->templatecache['navbar'] .= $vbulletin->templatecache['afm_latestfm']; break;
      case 
2$vbulletin->templatecache['FORUMHOME'] = str_replace('<!-- main -->''<!-- what\'s going on box -->'.$vbulletin->templatecache['afm_latestfm'], $vbulletin->templatecache['FORUMHOME']); break;
      case 
3$vbulletin->templatecache['FORUMHOME'] = str_replace('<!-- what\'s going on box -->''<!-- end what\'s going on box -->'.$vbulletin->templatecache['afm_latestfm'], $vbulletin->templatecache['FORUMHOME']); break;
      case 
4$vbulletin->templatecache['FORUMHOME'] = str_replace('<!-- end what\'s going on box -->''<!-- end what\'s going on box -->'.$vbulletin->templatecache['afm_latestfm'], $vbulletin->templatecache['FORUMHOME']); break;
    } 

Replace With (replace "X" with style id where it SHOULDN'T SHOW):
PHP Code:

if (STYLEID != X)
{
    switch (
$vbulletin->options['afm_yer'])
    {
      case 
1$vbulletin->templatecache['navbar'] .= $vbulletin->templatecache['afm_latestfm']; break;
      case 
2$vbulletin->templatecache['FORUMHOME'] = str_replace('<!-- main -->''<!-- what\'s going on box -->'.$vbulletin->templatecache['afm_latestfm'], $vbulletin->templatecache['FORUMHOME']); break;
      case 
3$vbulletin->templatecache['FORUMHOME'] = str_replace('<!-- what\'s going on box -->''<!-- end what\'s going on box -->'.$vbulletin->templatecache['afm_latestfm'], $vbulletin->templatecache['FORUMHOME']); break;
      case 
4$vbulletin->templatecache['FORUMHOME'] = str_replace('<!-- end what\'s going on box -->''<!-- end what\'s going on box -->'.$vbulletin->templatecache['afm_latestfm'], $vbulletin->templatecache['FORUMHOME']); break;
    }


It varies depending on the modification. While the replace will mostly be similar, the implementation before and after it varies.


All times are GMT. The time now is 07:27 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01169 seconds
  • Memory Usage 1,767KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete