vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   How to add CMS to $vboptions (https://vborg.vbsupport.ru/showthread.php?t=251035)

Budget101 09-23-2010 01:41 PM

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?

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:

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 :

https://vborg.vbsupport.ru/external/2010/09/15.jpg


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 


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

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} ?

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}:
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.

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)
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);


All times are GMT. The time now is 11:19 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.01141 seconds
  • Memory Usage 1,755KB
  • 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
  • (1)bbcode_html_printable
  • (10)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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