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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-23-2010, 01:41 PM
Budget101 Budget101 is offline
 
Join Date: Jul 2008
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to add CMS to $vboptions

Is it possible to add cms phrases to $vboptions so they can be called when needed?

Currently, when a new article is posted it
PHP Code:
$vbphrase[comment_thread_firstpost]

You can view the page at [url={1}]{1}[/url
creates a link to an article.

I want to edit this so that it pulls the brief preview description along with the link, when it posts.

I tried:
PHP Code:
{article_ preview}  [url={1}]{article_title}[/url
but that didn't work out...
The phrase variables I want to include are article_preview & article_title. Does anyone know the correct format for adding these variables into the phrase?? Or how to add CMS phrases into vboptions so they can be called in the phrase?
Reply With Quote
  #2  
Old 09-23-2010, 01:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You wouldn't use {article_preview} in a phrase. It would be $article_preview. Assuming that variable is even valid. If you do a search for the phrase "comment_thread_firstpost", you'll find it created in packages/vbcms/content.php, and that is leading me to think the variable may just be $preview, not $article_preview (and I'm guessing the title one is wrong too). And, I'm also thinking you may have to enter them as {2} and {3} and pass the info by modifying the line in that page.
Reply With Quote
  #3  
Old 09-23-2010, 02:16 PM
Budget101 Budget101 is offline
 
Join Date: Jul 2008
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne, thanks...

the currently (original) existing line in that phrase is:

PHP Code:
You can view the page at [url={1}]{1}[/url
How do I determine what the variable is? When I go into Phrase Manager and type in the Content Management System (Which lists all the phrases within CMS), it shows :




Do I call those varnames using $varname ?

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

When I try using:

PHP Code:
[$article_preview={2}]
 
Check out our latest article  [url={1}]{3}[/url
It comes out like this:

PHP Code:
[$article_preview=%2$s]
Check out our latest article %3$s 
Reply With Quote
  #4  
Old 09-23-2010, 02:28 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I guess I don't understand what you are trying to do. You want to put the phrase $vbphrase[article_preview] into the phrase $vbphrase[comment_thread_firstpost]? I thought you were trying to put a variable in there, not a phrase.

Did you look at the file I mentioned? It's around line 944 that the phrase is created. You would (maybe) have to edit that to pass the other variables you want to use in there and then you would enter the variables as {2} and {3} (just like the page url is a variable that is entered as {1} and is passed to the phrase in that line I mention).
Reply With Quote
  #5  
Old 09-23-2010, 02:41 PM
Budget101 Budget101 is offline
 
Join Date: Jul 2008
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
I guess I don't understand what you are trying to do. You want to put the phrase $vbphrase[article_preview] into the phrase $vbphrase[comment_thread_firstpost]? I thought you were trying to put a variable in there, not a phrase.
Ok, I'm sorry to be confusing, I guess I'm not working it properly. When a new article is posted, it automatically creates a thread in the vbCMS Comments forum. That thread says the following:

Quote:
You can view the page at (inserts link to the article here)
When I edit the phrase (which is
PHP Code:
$vbphrase[comment_thread_firstpost
that controls that posting, it contains the following information:

PHP Code:
You can view the page at [URL]{1}[/URL
Instead, I want it to show a brief description (pulled by the article preview) and a clickable link (The Title of the article).

I went to the file you suggested and I see this line:
PHP Code:
$message = new vB_Phrase('vbcms''comment_thread_firstpost'$this->getPageURL()); 
But I don't know how to properly edit it to include both the article title and the preview.

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

Would I change it to:

PHP Code:
$message = new vB_Phrase('vbcms''comment_thread_firstpost''article_preview''article_title' $this->getPageURL()); 
and then call the variables {2} {3} ?
Reply With Quote
  #6  
Old 09-23-2010, 06:33 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to read the code to see what vB_Phrase is doing. First variable is the name of the phrasegroup, vbcms. Second is the name of the phrase, comment_thread_firstpost. Third is a variable being passed, $this->getPageURL(), in this case it would be {1} in the phrase itself. If you put another after it, $variable2, it will be {2}... another after it will be {3}:
PHP Code:
$message = new vB_Phrase('vbcms''comment_thread_firstpost'$this->getPageURL(), $variable2$variable3); 
Then:
HTML Code:
Variable 2 is {2}

You can view the page at [url]{1}[/url]
And, as I said before, I don't think it is called $article_title. Look at the code right before the phrase is created - there is NO variable called $article_title to use.
Reply With Quote
  #7  
Old 09-23-2010, 11:41 PM
Budget101 Budget101 is offline
 
Join Date: Jul 2008
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I finally got it, thank you so much for your help lynne, as usual, you're an angel :-)
Reply With Quote
  #8  
Old 02-16-2015, 12:11 AM
Budget101 Budget101 is offline
 
Join Date: Jul 2008
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*Bumping* Ok.. in the last few years the code in packages>vbcms>content.php has changed to this:
(Line 1055)
Code:
        $message = new vB_Phrase('vbcms', 'comment_thread_firstpost', $this->getPageURL(array(), true));
I'm trying to get this to work using the latest updated ver of vb.

I tried the following:
Quote:
$message = new vB_Phrase('vbcms', 'comment_thread_firstpost', $this->getPageURL(), $title, $message);
but it didn't work using

Quote:
{3}

Read More: {2}
The url worked, but the description didn't.

Any Ideas on the correct syntax?? Thank you in advance!

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

Nevermind, got it.

Code:
$message = new vB_Phrase('vbcms', 'comment_thread_firstpost', $this->getPageURL(), $this->content->getDescription(), $title);
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 08:51 PM.


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.06367 seconds
  • Memory Usage 2,257KB
  • Queries Executed 13 (?)
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
  • (2)bbcode_code
  • (1)bbcode_html
  • (10)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete