Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-08-2007, 10:03 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to read vbulletin->options from database?

I have a script that reads from database and write the data in a file.
What is the proper syntax for that please?

I tried putting in database:

Quote:
<Background backgroundColor=\"".$vbulletin->options['mybg']."\"
and
Quote:
<Background backgroundColor=\"".$GLOBALS['vbulletin']->options['mybg']."\"
They don't work.
Reply With Quote
  #2  
Old 10-08-2007, 11:16 PM
Guest190829
Guest
 
Posts: n/a
Default

Not sure exactly what you are asking... We need a little more than a single line to see what you are doing.
Reply With Quote
  #3  
Old 10-08-2007, 11:21 PM
EnIgMa1234 EnIgMa1234 is offline
 
Join Date: Mar 2006
Location: .:: Ireland ::.
Posts: 1,306
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think he's trying to get a vbulletin option, to be added into a file, in the tag.

$vbulletin->options['mybg'] = #000000

So this would be added to the file:
<Background backgroundColor="#000000">

I think
Reply With Quote
  #4  
Old 10-08-2007, 11:22 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK. I am writing to an xml. If I put in the php:

$xml=bgcolor=".$vbulletin->options['mybg']." That is fine. The xml gets written with the correct value.

Now, if I put those in the db and do a query_first to retrieve it, then in the php I do

$xml=$myquery[result];

the xml gets written with the unconverted value for the option. It just displays bgcolor=".$vbulletin->options['mybg']." I tried the first post codes with no success.

Same goes for $vbphrase.

the very hard way I am trying to avoid would be to do a str_replace before I write to the xml. But there are so many options and phrases involved ...
Reply With Quote
  #5  
Old 10-09-2007, 03:03 AM
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Posts: 656
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why are you manually writing options and phrases to a database? vB handles them all transparently. Just fire up a plugin for example and you can use $vbulletin->options without doing anything beforehand.
Reply With Quote
  #6  
Old 10-09-2007, 03:27 AM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It has to be in database.

--------------- Added at 02:12 ---------------

No one can help?
Reply With Quote
  #7  
Old 10-09-2007, 06:35 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please show the full lines of code that is handling this, will be a lot easier to help you then.
Reply With Quote
  #8  
Old 10-09-2007, 06:52 AM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The idea: I am releasing this slideshow mod found in my homepage
which auto updates: install and forget about it.
It's a dynamic flash slideshow that reads from an XML.

I decided to release it with 3 different layouts options. All was fine the way I did it with database, until I thought it would be neat to allow users to customize it to their taste. So in vb options they have 3 choices of layout. Plus they can make it the colors they want plus it uses phrases for the non english members..

So the plugins for when creating/updating/deleting a thread create an xml whenever there are actions in preset forums.

the template in database (lots of lines) so I am putting only this. $vbphrase are also involved.

Quote:
etc... etc... <Background backgroundColor=\"".$vbulletin->options['cover_main_bg']."\" etc... etc...
So depending on user choice, I select appropriate template from db and create the XML on the fly.

And as described in first post, what gets written in the xml is the raw code, no matter what I try.
Reply With Quote
  #9  
Old 10-09-2007, 07:01 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is the content of $template['template']?

Most likely the variable does not get parsed because of the stripslashes().
Reply With Quote
  #10  
Old 10-09-2007, 07:05 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So if I'm reading this right - the code you are referring to is part of $template['template'] ?

If that's the case then yes, you will simply get the code - as all you are doing is getting the contents and storing them in $myxml. You would need to eval the contents - and they would need to be in a format that eval can handle.

Alternatively, you could store some unique text in the template where the value should go, and do a replacement on it after getting the contents.
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 01:12 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.17195 seconds
  • Memory Usage 2,268KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (9)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete