vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Link to "this page"? (https://vborg.vbsupport.ru/showthread.php?t=304675)

Morrus 11-18-2013 12:10 AM

Link to "this page"?
 
Probably a very simple, silly question. I made a a toggle to switch styles at the top of my forum (depending which style you're in, it's just a pair of conditional links to the URl of the home page with ?styleid=x after it).

It works fine, but takes people to the home page when they click on it. What would I need to use for the URL to keep the user on the same page, and simply switch the style? I.e., what's the template code which outputs the URL of the page currently being viewed?

Digital Jedi 11-18-2013 12:31 AM

Try just putting the style changer command in the link:

HTML Code:

<a href="?styleid=x">Style X</a>

Morrus 11-18-2013 01:08 AM

You mean just miss out the part of the URL before the question mark? Currently I have:

Code:

<a href="http://www.site.com?styleid=x">Switch Style</a>
--------------- Added [DATE]1384741257[/DATE] at [TIME]1384741257[/TIME] ---------------

Just tried your version. It takes me back to the home page just like my version does, unfortunately.

Digital Jedi 11-18-2013 03:30 AM

Ah, yes, I wasn't thinking. Actually, there is a way, but you may have to use more if conditions, because ? can only be used once in the URL. Once you instantiate it, you then have to add additional functions with &amp;.


So if a user is on this page (forumdisplay.php?3-D-amp-D-and-Pathfinder), the code would need to look like this:
HTML Code:

<a href="{vb:raw relpath}&amp;styleid=X">Style X</a>
But if he's on this page (blog.php), it needs to look like this.
HTML Code:

<a href="{vb:raw relpath}?styleid=X">Style X</a>
It's doable. But probably more work that you had planned.

Morrus 11-18-2013 10:38 AM

Eeek, no, you're right - that would be unfeasibly bulky. There' a lot of different pages!

Looks like a return to the home page is going to be necessary then. That's a shame; still, it's not the end of the world! Thanks for the help!

ozzy47 11-18-2013 11:17 AM

What is the original code you were trying to use?

Morrus 11-18-2013 12:06 PM

Quote:

Originally Posted by ozzy47 (Post 2461767)
What is the original code you were trying to use?

It's not really code; just a link - the one I posted above:

Code:

<a href="http://www.site.com?styleid=x">Switch Style</a>

ozzy47 11-18-2013 12:09 PM

What about the conditionals?

Morrus 11-18-2013 01:18 PM

Oh, that just gives a different link depending on the viewing style:

Code:

<vb:if condition="$bbuserinfo['styleid']==14"><a href="?styleid=19">Switch Style</a>
<vb:else />
<a href="?styleid=14">Switch Style</a>
</vb:if>


ozzy47 11-18-2013 01:21 PM

Ok that's what I thought, I'll do some testing when I get home from work.


All times are GMT. The time now is 12:02 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.01032 seconds
  • Memory Usage 1,732KB
  • 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
  • (3)bbcode_code_printable
  • (3)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete