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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-23-2011, 11:47 AM
emperatour emperatour is offline
 
Join Date: Sep 2008
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [CMS] Add thread link to article preview

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



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


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

thanks in advance,
Attached Images
File Type: png Capture.PNG (2.4 KB, 0 views)
File Type: png 2.PNG (1.7 KB, 0 views)
Reply With Quote
  #2  
Old 01-23-2011, 05:29 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 01-24-2011, 08:01 AM
thieu.bocap thieu.bocap is offline
 
Join Date: Apr 2009
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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!
Reply With Quote
  #4  
Old 01-24-2011, 09:55 AM
emperatour emperatour is offline
 
Join Date: Sep 2008
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 01-24-2011, 04:44 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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']; 
Reply With Quote
  #6  
Old 01-25-2011, 03:50 AM
emperatour emperatour is offline
 
Join Date: Sep 2008
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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,
Reply With Quote
Благодарность от:
Phoebes
  #7  
Old 07-15-2011, 07:43 PM
Phoebes Phoebes is offline
 
Join Date: Jun 2011
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 07-15-2011, 11:22 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is an article on writing the friendly urls correctly here - vBulletin 4 Template Syntax: Links
Reply With Quote
  #9  
Old 07-16-2011, 02:23 AM
Phoebes Phoebes is offline
 
Join Date: Jun 2011
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 09-23-2014, 08:27 AM
hoangserip's Avatar
hoangserip hoangserip is offline
 
Join Date: Jun 2009
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for Lynne, I also have problems with friendly urls, hope you can help me complete
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 07:49 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.04509 seconds
  • Memory Usage 2,309KB
  • Queries Executed 14 (?)
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
  • (5)bbcode_php
  • (2)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
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (10)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_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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete