vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Design and Graphics Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=253)
-   -   [CMS] Add thread link to article preview (https://vborg.vbsupport.ru/showthread.php?t=257656)

emperatour 01-23-2011 11:47 AM

[CMS] Add thread link to article preview
 
1 Attachment(s)
Hi,

In vB4 CMS, in order to reach the promoted forum posts we have to open the article and click on the tiny url at the end of each article (vbcms_content_article_page):
https://vborg.vbsupport.ru/attachmen...1&d=1295789254


I would like have the same thing in my article preview (cms home page) for each of the articles.

I found the codes in template "vbcms_content_article_page" which is for this part of articles.
PHP Code:

<vb:if condition="$promoted_threadid">
        <
div class="fullsize article_promoted_text_container">
            <
sub class="article_promoted_text">
                {
vb:rawphrase promoted_post_intro}
                <
a href="{vb:link thread, {vb:raw threadinfo}}">{vb:raw postitle}</a>
                {
vb:rawphrase promoted_thread_startedby}
                <
a href="{vb:link member, {vb:raw poststarter}}">{vb:var postauthor}</a>
            </
sub>

            <
sub class="article_promoted_text">
                <
a href="{vb:raw post_url}">{vb:rawphrase view_original_post}</a>
            </
sub>
        </
div>
    </
vb:if> 

But somehow I can't use some of variables in template "vbcms_content_article_preview".
vb:link thread
vb:raw threadinfo
vb:link member
vb:raw poststarter
vb:raw post_url

These variables are not accessible from "vbcms_content_article_preview" template. However I only need vb:raw post_url to get the url and $promoted_threadid to get the condition.

This is what I get in CMS home page (vbcms_content_article_preview):
https://vborg.vbsupport.ru/attachmen...1&d=1295789254

I really need to have thread links in article preview in my CMS. I would appreciate your help.

thanks in advance,

Lynne 01-23-2011 05:29 PM

You need a plugin to get the thread id, I believe. Something like (at vbcsm_article_populate_end):
PHP Code:

$record vB::$vbulletin->db->query_first("SELECT a.threadid
                FROM " 
TABLE_PREFIX "cms_article AS a 
                JOIN " 
TABLE_PREFIX "cms_node ON(cms_node.contentid = a.contentid) 
                WHERE nodeid = " 
$this->getNodeId());

$view->threadid $record['threadid']; 

Now you can use the threadid to make a link in the template.

thieu.bocap 01-24-2011 08:01 AM

Quote:

Originally Posted by Lynne (Post 2153433)
You need a plugin to get the thread id, I believe. Something like (at vbcsm_article_populate_end):
PHP Code:

$record vB::$vbulletin->db->query_first("SELECT a.threadid
                FROM " 
TABLE_PREFIX "cms_article AS a JOIN cms_node ON(cms_node.contentid = a.contentid) WHERE nodeid = " $this->getNodeId());

$view->threadid $record['threadid']; 

Now you can use the threadid to make a link in the template.

Sorry, you can more detailed instructions, i need too!

Thanks!

emperatour 01-24-2011 09:55 AM

Thanks a lot Lynne for your answer,

When I add this as a plugin in hook location vbcms_article_populate_end i get the following db error:

Quote:

Database error in vBulletin 4.1.1:

Invalid SQL:
SELECT a.threadid
FROM vbt_cms_article AS a JOIN cms_node ON(cms_node.contentid = a.contentid) WHERE nodeid = 174;

MySQL Error : Table 'myhostusername_vbulletin.cms_node' doesn't exist
Error Number : 1146
Script : http://..../forum/content.php
Product: vBulletin or vBulletin CMS
Execution Order: 5

I appreciate if you tell me the correct way to do this.

Lynne 01-24-2011 04:44 PM

Then add the prefix in front of the other table name also:
PHP Code:

$record vB::$vbulletin->db->query_first("SELECT a.threadid
                FROM " 
TABLE_PREFIX "cms_article AS a 
                JOIN " 
TABLE_PREFIX "cms_node ON(cms_node.contentid = a.contentid) 
                WHERE nodeid = " 
$this->getNodeId());

$view->threadid $record['threadid']; 


emperatour 01-25-2011 03:50 AM

I successfully created the plugin after adding another prefix for cms_node.
This will be the correct codes which I used:
PHP Code:

$record vB::$vbulletin->db->query_first("SELECT a.threadid
                FROM " 
TABLE_PREFIX "cms_article AS a 
                JOIN " 
TABLE_PREFIX "cms_node ON(" TABLE_PREFIX "cms_node.contentid = a.contentid) 
                WHERE nodeid = " 
$this->getNodeId());

$view->threadid $record['threadid']; 

In case someone else want to know, I used threadid in templates in this format: {vb:raw threadid}

I truly appreciate your help Lynne.
regards,

Phoebes 07-15-2011 07:43 PM

I was looking to do this same thing.
I followed what you did here and I can get it to link to the correct post by using something like:

Code:

<a href="showthread.php?{vb:raw threadid}">{vb:raw title}</a>
but, is there a way to get the link to have the search engine friendly appended title text to the end of the link?
Instead of the link looking like ...showthread.php?37. it would look like ...showthread.php?37-title-text-here

Lynne 07-15-2011 11:22 PM

There is an article on writing the friendly urls correctly here - vBulletin 4 Template Syntax: Links

Phoebes 07-16-2011 02:23 AM

Thanks for the link Lynne, but It's not working for me still.


Is


Code:

$record = vB::$vbulletin->db->query_first("SELECT a.threadid
                FROM " . TABLE_PREFIX . "cms_article AS a
                JOIN " . TABLE_PREFIX . "cms_node ON(" . TABLE_PREFIX . "cms_node.contentid = a.contentid)
                WHERE nodeid = " . $this->getNodeId());

$view->threadid = $record['threadid'];


enough to give the vbcms_content_article_preview template access to the title information? The only thing I can generate is the thread id. Is there another query I need to add to get the title? If so, I'm not sure of the syntax for that.

hoangserip 09-23-2014 08:27 AM

Thanks for Lynne, I also have problems with friendly urls, hope you can help me complete

ozzy47 09-23-2014 10:39 AM

Quote:

Originally Posted by hoangserip (Post 2516241)
Thanks for Lynne, I also have problems with friendly urls, hope you can help me complete

This thread is three years old, you need to start your own thread, and provide more information. " I also have problems with friendly urls " is not very descriptive.:)


All times are GMT. The time now is 05:52 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.01188 seconds
  • Memory Usage 1,769KB
  • 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
  • (5)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (11)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