vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Save CSS in files (https://vborg.vbsupport.ru/showthread.php?t=159924)

Alphawolf83 10-10-2007 03:33 PM

Save CSS in files
 
Hey there,

the option to save CSS into files on the server outputs the following link to the CSS file:
Code:

<link rel="stylesheet" type="text/css" href="clientscript/vbulletin_css/vbulletin_dfgfdgfdgfdgdfgr556464.css" />
However, the structure of our forum is like following:
./ = (root) Portal
./forum/ = Forum

Now, as long as I move inside the /forum/ the above link works fine, since the clientscript/vbulletin_css/ folder is located inside the /forum/ folder. :)

However, when I navigate to our Portal (which is completely written by ourselves, no hacks etc.), the link to the css files doesnt work anymore, understandably. The link then should looks like this
Code:

<link rel="stylesheet" type="text/css" href="forum/clientscript/vbulletin_css/vbulletin_dfgfdgfdgfdgdfgr556464.css" />
to work properly.

So now, how do I change the automatically generated link to the CSS file when I am outside the forum or in general? Hope, anything was understandable (I'm german ;)).

Greetz

Analogpoint 10-10-2007 04:59 PM

There are *lots* of ways to deal with something like this. One way would be mod vB to output an absolute URL for that link, then it would work everywhere. I'd probably do this. Another way, would be in your portal code, buffer the output to the browser then fix the link

PHP Code:

// at the beginning
ob_start();

// at the end
$allcontent ob_get_clean();
$allcontent str_replace('href="clientscript/vbulletin_css/''href="forum/clientscript/vbulletin_css/'$allcontent);
echo 
$allcontent

And then there are lots of other ways too :)

Alphawolf83 10-10-2007 07:55 PM

Unfortunately, that didnt work for any reason, but a fellow administrator had a working solution. :)

- Create Plugin (Hook: global_complete):
PHP Code:

$output preg_replace('/<link ([^>]*)href="(?!http|\/)([^"]+)"/''<link $1href="'.$vbulletin->options[bburl].'/$2"'$output); 


Works just like a charm. Thanks spli. :p

Dismounted 10-11-2007 10:11 AM

Or you could just put this in your headinclude template.
HTML Code:

<base href="$vboptions[bburl]" />

Analogpoint 10-11-2007 01:53 PM

Quote:

Originally Posted by Dismounted (Post 1357476)
Or you could just put this in your headinclude template.
HTML Code:

<base href="$vboptions[bburl]" />

Which would break any other relative links you have on the page. Of course if there are no other relative links, that's a perfect solution. (And one that didn't cross my mind.) :)


All times are GMT. The time now is 10:45 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.01188 seconds
  • Memory Usage 1,731KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_html_printable
  • (2)bbcode_php_printable
  • (1)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