vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Possible to count number of loops through a template? (https://vborg.vbsupport.ru/showthread.php?t=81867)

vasudeva 05-22-2005 05:41 PM

Possible to count number of loops through a template?
 
I'm trying to customize the navbar breadcrumb bit, which by default looks like:
Quote:

Sitename > Forum > Forumname > Threadname
I want it to look more like a stair-step layout, like:
Code:

Sitename
  -Forum
      -Forumname
          -Threadname

Which is how the breadcrumb looks if you hit the 'Show Printable Page' link on a thread, like this.

I can't think of a way to do it in CSS -- that is, assign an increasingly right-positioned class to each successive div -- because the navbar template calls the navbar_link template which just generically outputs code for each link portion, making them all the same.

It would be perfect if there was some way to insert a counter in the navbar_link template, and increase it by 1 on every pass through when called for a given instance of the navbar template, because then I could do something like class="navbar_$counter" and then have 3 or 4 classes, .navbar_counter1 through .navbar_counter4, each with an increasingly larger right-position. But I suspect this isn't possible.

Is it?

(I tried hardcoding the navbar code right into the navbar template so I could control the classes used, but then realized this isn't as portable as I'd like. For example, I'd have to also make it aware of the breadcrumb used in the usercp pages.)

akanevsky 05-22-2005 08:15 PM

I wouldn't do an increasingly right positioned class in css...

I'd make a
style="margin-left: $increasedmarginvalue".
And I would parse the value within php script.

vasudeva 05-22-2005 08:38 PM

Quote:

Originally Posted by Dark Visor
I wouldn't do an increasingly right positioned class in css...

I'd make a
style="margin-left: $increasedmarginvalue".
And I would parse the value within php script.

I could, but I'd rather keep my edits at the template/CSS level, if possible. Feels more contained, I guess.

akanevsky 05-22-2005 08:59 PM

I'd say that is impossible. Because you would have to change the CSS everytime, and that means you would have to re-include the CSS code everytime, which would be buggy and less "contained" in total.

vasudeva 05-22-2005 09:17 PM

Quote:

Originally Posted by Dark Visor
I'd say that is impossible. Because you would have to change the CSS everytime, and that means you would have to re-include the CSS code everytime, which would be buggy and less "contained" in total.

Yes. So, can I take this emphasis on CSS vs PHP to indicate that there is no built-in facility to detect how many times one template calls another? VB always surprises me with the set of variables it makes available, but I'm not holding my breath on this one.


All times are GMT. The time now is 08:17 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.00972 seconds
  • Memory Usage 1,725KB
  • 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
  • (1)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete