View Full Version : How to add CMS to $vboptions
Budget101
09-23-2010, 01:41 PM
Is it possible to add cms phrases to $vboptions so they can be called when needed?
Currently, when a new article is posted it $vbphrase[comment_thread_firstpost]
You can view the page at {1}
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:
{article_ preview} {article_title} ({1})
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?
Lynne
09-23-2010, 01:52 PM
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.
Budget101
09-23-2010, 02:16 PM
Hi Lynne, thanks...
the currently (original) existing line in that phrase is:
You can view the page at {1}
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 :
https://vborg.vbsupport.ru/external/2010/09/15.jpg
Do I call those varnames using $varname ?
--------------- Added 1285255411 at 1285255411 ---------------
When I try using:
[$article_preview={2}]
Check out our latest article {3} ({1})
It comes out like this:
[$article_preview=%2$s]
Check out our latest article %3$s
Lynne
09-23-2010, 02:28 PM
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).
Budget101
09-23-2010, 02:41 PM
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:
You can view the page at (inserts link to the article here)
When I edit the phrase (which is $vbphrase[comment_thread_firstpost] that controls that posting, it contains the following information:
You can view the page at {1}
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:
$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 1285256606 at 1285256606 ---------------
Would I change it to:
$message = new vB_Phrase('vbcms', 'comment_thread_firstpost', 'article_preview', 'article_title' $this->getPageURL());
and then call the variables {2} {3} ?
Lynne
09-23-2010, 06:33 PM
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}:
$message = new vB_Phrase('vbcms', 'comment_thread_firstpost', $this->getPageURL(), $variable2, $variable3); Then:
Variable 2 is {2}
You can view the page at {1} 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.
Budget101
09-23-2010, 11:41 PM
I finally got it, thank you so much for your help lynne, as usual, you're an angel :-)
Budget101
02-16-2015, 12:11 AM
*Bumping* Ok.. in the last few years the code in packages>vbcms>content.php has changed to this:
(Line 1055)
$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:
$message = new vB_Phrase('vbcms', 'comment_thread_firstpost', $this->getPageURL(), $title, $message);
but it didn't work using
{3}
Read More: {2} ({1})
The url worked, but the description didn't.
Any Ideas on the correct syntax?? Thank you in advance!
--------------- Added 1424053817 at 1424053817 ---------------
Nevermind, got it.
$message = new vB_Phrase('vbcms', 'comment_thread_firstpost', $this->getPageURL(), $this->content->getDescription(), $title);
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.