Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 04-08-2011, 07:06 PM
edyy edyy is offline
 
Join Date: Jul 2010
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Different template for articles

Hello, I am interested if it is possible to make different layout ( template ) for articles. To make myself more clear and easy to understand I will try to make an example.
Let's say that i have two menu section on my site ( cms ) news and games.
In the section games when i click on an article i want the variables "title" , " posted by " , "categories" etc to be shown in an order. In the news section i want when someone clicks on the article to be shown just "published" by and "categories"

I hope that was a clear example and also I hope that I express myself corectly ( english is not my native language )

Thanks!
Reply With Quote
  #2  
Old 04-08-2011, 10:23 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You may assign different styles to different sections. So just have the article template different in each style.
Reply With Quote
  #3  
Old 04-09-2011, 10:21 AM
edyy edyy is offline
 
Join Date: Jul 2010
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

now if I may another problem. I want to add to the edit article page 3 more blockrows and put the data from here in article similar woth published by. i will post the modification i made so far, in vbcms_content_article_page i did that

HTML Code:
{vb:raw css}

<div class="article_width" id="article_content">
	<div class="title">
                <h1 class="article_title cms_article_title"><span>{vb:raw title}</span>
                        <vb:if condition="$can_edit">
                                <a href="{vb:raw edit_url}" class="edit"><img class="editimage" src="{vb:stylevar imgdir_cms}/edit_small.png" alt="{vb:rawphrase edit}" /></a>
                        </vb:if>
		</h1>
        
	</div>
	<div class="article_author_date_comment_container">
                <vb:comment>
                        <vb:if condition="$showuser">
                                <div>
                                        <a href="{vb:link member, {vb:raw userid}}"><img src="{vb:raw vboptions.bburl}/image.php?{vb:raw session.sessionurl}u={vb:raw userid}&amp;type=profile" alt="" class="post_avatar" /></a>
                                </div>
                        </vb:if>
                </vb:comment>
		<div class="fullwidth">
			<vb:if condition="$show['fb_likebutton']">
				<div>{vb:raw fblikebutton}</div>
			</vb:if>
            <div class="cmslinks">
            <vb:if condition="!empty($categories)">
				{vb:phrase in_category}
				<ol class="commalist">
					<vb:each from="categories" key="categoryid" value="category">
						<li><a href="{vb:raw category.category_url}">{vb:raw category.category}</a></li>
					</vb:each>
				</ol>
		</vb:if>
        </div>
        <div class="producator">
        	Producator:
        	<ol class="list">
        		<vb:each from="categories" key="categoryid" value="category">
        			<li><a  target="_blank" href="{vb:raw producator_url}">{vb:raw producator}</a></li>
        		</vb:each>
        	</ol>
        </div>
        <div class="platforma">
        	Platforma:
        	<ol class="list">
        		<vb:each from="categories" key="categoryid" value="category">
        			<li><a href="{vb:raw platforma_url}">{vb:raw platforma}</a></li>
       			 </vb:each>
        	</ol>
        </div>
        <div class="distribuitor">
        	Distribuitor:
        	<ol class="list">
        		<vb:each from="categories" key="categoryid" value="category">
        			<li><a target="_blank" href="{vb:raw distribuitor_url}">{vb:raw distribuitor}</a></li>
        		</vb:each>
        	</ol>
        </div>
			<div class="article_username_container<vb:if condition="!$showrating">_full</vb:if>">       
                        <vb:if condition="$showuser">
                               {vb:rawphrase by_x_nolink, {vb:raw memberaction_dropdown}}
                        <vb:else />&nbsp;
                        </vb:if>
                         </div>
                        <vb:if condition="$showrating">
                                <div class="article_rating_container">
                                        <div class="popupmenu cmsratingmenu" id="cmsrating">
                                                <h6><a class="popupctrl" href="javascript://" id="cmsrating_current"><vb:if condition="$rating"><img class="inlineimg" src="{vb:stylevar imgdir_rating}/rating-15_{vb:raw rating}.png" alt="{vb:phrase rating_x_votes_y_average, {vb:raw ratingnum}, {vb:raw ratingavg}}" /><vb:else />{vb:rawphrase rate_this_article}</vb:if></a></h6>
                                                <form action="content.php?{vb:raw node}/rate" method="post" id='cms_cmsrate_form'>
                                                        <ul class="popupbody popuphover">
                                                                <vb:if condition="$showratenode">
                                                                        <li><label for="r5"><span class="rating5 cmsrating {vb:stylevar right}">
                                                                                <input type="radio" name="vote" value="5" id="r5" {vb:raw votechecked.5} tabindex="1" /> {vb:rawphrase excellent}
                                                                        </span></label></li>
                                                                        <li><label for="r4"><span class="rating4 cmsrating {vb:stylevar right}">
                                                                                <input type="radio" name="vote" value="4" id="r4" {vb:raw votechecked.4} tabindex="1" /> {vb:rawphrase good}
                                                                        </span></label></li>
                                                                        <li><label for="r3"><span class="rating3 cmsrating {vb:stylevar right}">
                                                                                <input type="radio" name="vote" value="3" id="r3" {vb:raw votechecked.3} tabindex="1" /> {vb:rawphrase average}
                                                                        </span></label></li>
                                                                        <li><label for="r2"><span class="rating2 cmsrating {vb:stylevar right}">
                                                                                <input type="radio" name="vote" value="2" id="r2" {vb:raw votechecked.2} tabindex="1" /> {vb:rawphrase bad}
                                                                        </span></label></li>
                                                                        <li><label for="r1"><span class="rating1 cmsrating {vb:stylevar right}">
                                                                                <input type="radio" name="vote" value="1" id="r1" {vb:raw votechecked.1} tabindex="1" /> {vb:rawphrase terrible}
                                                                        </span></label></li>
                                                                        <li class="formsubmit"><input type="submit" class="button" value="{vb:rawphrase vote_now}" tabindex="1" /></li>
                                                                <vb:else />
                                                                        <li><label>{vb:rawphrase already_rated_this_article}</label></li>
                                                                </vb:if>
                                                        </ul>
                                                        <input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
                                                        <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
                                                </form>
                                                <script type="text/javascript" src="clientscript/cms_ajax_rate.js?v={vb:raw vboptions.simpleversion}"></script>
                                                <script type="text/javascript">
                                                <!--
                                                        var nodeid = {vb:raw node};
                                                        vB_AJAX_CMSRate_Init('cms_cmsrate_form');
                                                //-->
                                                </script>
                                        </div>
                                </div>
                        </vb:if>
                        <div class="cms_clear"></div>
                        <vb:if condition="($showpublishdate OR ($showupdated AND $lastupdated) OR ($viewcount AND $showviewcount)) OR $comment_block">
				<div class="article_username_container">
					<vb:if condition="$showpublishdate">
						<vb:if condition="!$published OR !$setpublish">
							<span style="color:red">
							<vb:if condition="$publishdate AND $setpublish">
								{vb:rawphrase page_will_be_published_x {vb:raw publishdatelocal}} {vb:raw publishtimelocal}
							<vb:else />
								{vb:rawphrase page_not_published}
							</vb:if>
							</span>
						<vb:elseif condition="$publishdate" />
							{vb:rawphrase published_on_x {vb:raw publishdatelocal}}  {vb:raw publishtimelocal}
						</vb:if>
					</vb:if>
					<vb:if condition="$showupdated and $lastupdated">
						&nbsp;{vb:rawphrase updated_on_x {vb:date {vb:raw lastupdated}, {vb:raw dateformat}}}
						&nbsp;
					</vb:if>
					<vb:if condition="$viewcount AND $showviewcount">
						&nbsp;{vb:rawphrase number_of_views}: {vb:raw viewcount}
						&nbsp;
					</vb:if>
				</div>
			</vb:if>
                       <vb:if condition="$comment_block">
                        <div class="article_rating_container">
                            	<a href="{vb:raw page_url}#comments"  rel="nofollow">{vb:raw comment_count} <vb:if condition="$comment_count == '1'">{vb:rawphrase comment}<vb:else />{vb:rawphrase comments}</vb:if></a>
				<img src="{vb:stylevar imgdir_misc}/comment.png" alt="{vb:rawphrase comments}" border="0" />
                        </div>
                       </vb:if>
		</div>
	</div>
    <vb:if condition="$next_page_url OR $prev_page_url">
        <div class="cms_toc_container fullwidth">
            <div class="navpopupmenu popupmenu nohovermenu">
                <span class="shade">{vb:rawphrase pages}:</span>
                <vb:each from="pagelist" value="page">
                    <vb:if condition="$page['selected']"><a href="{vb:raw page.url}" class="popupctrl"><span class="ctrlcontainer">{vb:raw page.title}</span></a></vb:if>
                </vb:each>
	 			<vb:if condition="$prev_page_url">
					&nbsp;<a href="{vb:raw prev_page_url}" class="textcontrol"><img src="{vb:stylevar imgdir_pagination}/previous-{vb:stylevar right}-black.png" alt="{vb:raw prev_page_phrase}" /></a>
				</vb:if>
				<vb:if condition="$next_page_url">
					&nbsp;<a href="{vb:raw next_page_url}" class="textcontrol"><img src="{vb:stylevar imgdir_pagination}/next-{vb:stylevar right}-black.png" alt="{vb:raw next_page_phrase}" /></a>
				</vb:if>
               <ul class="navpopupbody popupbody popuphover">
                    <vb:each from="pagelist" value="page">
                        <!-- selected: {$page.selected} -->
                        <li><a href="{vb:raw page.url}">{vb:raw page.title}</a></li>
                    </vb:each>
                </ul>
            </div>
      </div>
    </vb:if>
    <div class="clear"></div>
	<div class="article cms_clear restore postcontainer">{vb:raw pagetext}</div>

	<vb:if condition="$showattachments">
	<div class="attachments">
		<vb:if condition="$thumbnailattachments">
			<fieldset class="postcontent">
				<legend><img src="{vb:stylevar imgdir_misc}/paperclip.png" class="inlineimg" alt="{vb:rawphrase attached_thumbnails}" /> {vb:rawphrase attached_thumbnails}</legend>
				{vb:raw thumbnailattachments}
			</fieldset>
		</vb:if>
		<vb:if condition="$imageattachments">
			<fieldset class="postcontent">
				<legend><img src="{vb:stylevar imgdir_misc}/paperclip.png" class="inlineimg" alt="{vb:rawphrase attached_images}" /> {vb:rawphrase attached_images}</legend>
				{vb:raw imageattachments}
			</fieldset>
		</vb:if>
		<vb:if condition="$imageattachmentlinks">
			<fieldset class="postcontent">
				<legend><img src="{vb:stylevar imgdir_misc}/paperclip.png" class="inlineimg" alt="{vb:rawphrase attached_images}" /> {vb:rawphrase attached_images}</legend>
				<ul>
				{vb:raw imageattachmentlinks}
				</ul>
			</fieldset>
		</vb:if>
		<vb:if condition="$otherattachments">
			<fieldset class="postcontent">
				<legend><img src="{vb:stylevar imgdir_misc}/paperclip.png" class="inlineimg" alt="{vb:rawphrase attached_files}" /> {vb:rawphrase attached_files}</legend>
				<ul>
				{vb:raw otherattachments}
				</ul>
			</fieldset>
		</vb:if>
	</div>
	</vb:if>

	<vb:if condition="$show['lightbox']">
		<script type="text/javascript" src="clientscript/vbulletin_lightbox.js?v={vb:raw vboptions.simpleversion}"></script>
		<script type="text/javascript">
		<!--
		vBulletin.register_control("vB_Lightbox_Container", "article_content", {vb:raw vboptions.lightboxenabled});
		//-->
		</script>
	</vb:if>

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

	<vb:if condition="$promoted_blogid">
		<sub class="article_promoted_text">
			{vb:rawphrase  promoted_post_intro_blog}
			<a href="{vb:raw blog_url}">{vb:raw postitle}</a>
			{vb:rawphrase promoted_thread_startedby}
			<a href="{vb:link member, {vb:raw poststarter}}">{vb:var postauthor}</a>
		</sub>
	</vb:if>
	<div class="cmslinks">

		
	<vb:if condition="$showtags AND $tag_count">
		<sub class="article_promoted_text">
			<span id="articletagcontainer_{$contentid}">
				{vb:rawphrase tags} :
				<span id="articletaglist_{vb:raw contentid}">{vb:raw tags}</span>
			</span>
		</sub>
	</vb:if>
	</div>

    <vb:if condition="$next_page_url OR $prev_page_url">
        <div class="cms_toc_container fullwidth">
            <div class="navpopupmenu popupmenu nohovermenu">
                <span class="shade">{vb:rawphrase pages}:</span>
                <vb:each from="pagelist" value="page">
                    <vb:if condition="$page['selected']"><a href="{vb:raw page.url}" class="popupctrl"><span class="ctrlcontainer">{vb:raw page.title}</span></a></vb:if>
                </vb:each>
	 			<vb:if condition="$prev_page_url">
					&nbsp;<a href="{vb:raw prev_page_url}" class="textcontrol"><img src="{vb:stylevar imgdir_pagination}/previous-{vb:stylevar right}-black.png" alt="{vb:raw prev_page_phrase}" /></a>
				</vb:if>
				<vb:if condition="$next_page_url">
					&nbsp;<a href="{vb:raw next_page_url}" class="textcontrol"><img src="{vb:stylevar imgdir_pagination}/next-{vb:stylevar right}-black.png" alt="{vb:raw next_page_phrase}" /></a>
				</vb:if>
               <ul class="navpopupbody popupbody popuphover">
                    <vb:each from="pagelist" value="page">
                        <!-- selected: {$page.selected} -->
                        <li><a href="{vb:raw page.url}">{vb:raw page.title}</a></li>
                    </vb:each>
                </ul>
            </div>
      </div>
    </vb:if>
	{vb:raw comment_block}

</div>
and in vbcms_content_article_inline i did that

HTML Code:
<div id="cms_url_check" style="display:none"></div>
<form action="{vb:raw view_url}" method="post" onsubmit="if(! checkTitles('{vb:escapejs $vbphrase['need_article_title']}', '{vb:escapejs $vbphrase['need_url']}')){return false};return vB_Editor['{vb:raw editorid}'].prepare_submit(0, 0)" id="{vb:raw formid}">
	<div class="fullwidth">
		{vb:raw editbar}
	</div>
	<div class="fullwidth">
		<div class="mainedit block">
			<div class="headerbar blockhead">
				{vb:raw typetitle} {vb:raw type}: {vb:raw title}
			</div>
			<div class="blockbody formcontrols floatcontainer">
			<vb:if condition="$errors.title">
				<div class="fullwidth"><span class="error">{vb:raw errors.title}</span></div>
			</vb:if>

			<vb:if condition="$can_edit">
				<div class="blockrow">
					<label class="quarter" for="title">{vb:rawphrase title}: </label>
					<div class="threequarters"><input type="text" name="cms_node_title" id="cms_node_title" value="{vb:raw title}" size="40" onfocus="if (this.value == '{vb:rawphrase new_article}') this.value = '';" onblur="javascript: if (document.getElementById('cms_node_url').value==''){makeSEOUrl(this.value,'cms_node_url','html_title');}" tabindex="1" class="textbox fullwidth" /></div>
				</div>
				<div class="blockrow">
					<label class="quarter" for="url">{vb:rawphrase url_alias}: </label>
					<div class="threequarters"><input type="text" name="cms_node_url" id="cms_node_url" value="{vb:raw url}" size="40" onblur="javascript:checkUrlAvailable(this, 'cms_url_check', {vb:raw nodeid})" tabindex="1" class="textbox fullwidth" /></div>
				</div>
                                <div class="blockrow">
					<label class="quarter" for="Producator">Producator: </label>
					<div class="threequarters"><input type="text" name="producator" id="producator" value="{vb:raw producator}" size="40" tabindex="1" class="textbox fullwidth" /></div>
				</div>
                <div class="blockrow">
					<label class="quarter" for="Platforma">Platforma: </label>
					<div class="threequarters"><input type="text" name="Platforma" value="{vb:raw platforma}" size="40" tabindex="1" class="textbox fullwidth" /></div>
				</div>
                <div class="blockrow">
					<label class="quarter" for="Distribuitor">Distribuitor: </label>
					<div class="threequarters"><input type="text" name="Distribuitor" id="Distribuitor" value="{vb:raw distribuitor}" size="40" tabindex="1" class="textbox fullwidth" /></div>
				</div>
			<vb:if condition="$showtags">
				<vb:if condition="$contentid">
					<div id="articletagcontainer_{vb:raw contentid}" class="blockrow tagcontainer">
						<label class="quarter taglabel">{vb:rawphrase tags}: </label>
						<div class="threequarters">
							<span id="articletaglist_{vb:raw contentid}">{vb:raw tags}</span>
							<span id="articletagmenu_{vb:raw contentid}">
							<a href="threadtag.php?{vb:raw session.sessionurl}do=manage&amp;contenttype=vBCms_Article&amp;contentid={vb:raw contentid}"><img src="{vb:stylevar imgdir_misc}/tag_edit.gif" border="0" class="inlineimg" id="articletag_{vb:raw contentid}" alt="{vb:rawphrase edit_tags}" /></a>
							</span>
						</div>

						<script type="text/javascript">
						vBulletin.register_control("vB_AJAX_TagEditor", "vBCms_Article", "{vb:raw contentid}", "article");
						</script>
						<script type="text/javascript" src="{vb:raw vboptions.bburl}/clientscript/vbulletin_menu.js?v={vb:raw vboptions.simpleversion}"></script>
						<script type="text/javascript" src="{vb:raw vboptions.bburl}/clientscript/vbulletin_ajax_tageditor.js?v={vb:raw vboptions.simpleversion}"></script>
						<script type="text/javascript" src="{vb:raw vboptions.bburl}/clientscript/vbulletin_ajax_suggest.js?v={vb:raw vboptions.simpleversion}"></script>
					</div>


				</vb:if>
			</vb:if>
	
			{vb:raw editor}
			<vb:else />
			{vb:raw previewtext}
			</vb:if>
			</div>

			<input type="hidden" id="contenttypeid" value="{vb:raw contenttypeid}" name="contenttypeid" />
			<input type="hidden" name="do" id="do_editform" value="update" />
			<input type="hidden" name="item_type" value="{vb:raw item_type}" />
			<input type="hidden" name="item_class" value="{vb:raw item_class}" />
			<input type="hidden" name="item_id" value="{vb:raw item_id}" />
			<input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
			<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
		</div>
		<div class="edit_rightside">
			{vb:raw publisher}
			{vb:raw metadata}
		</div>
	</div>
</form>
now, my problem is that i can get the info from the blockrow into the article, how can i do that ?


I must tell you that i am a strager to any form of programing, a real stranger.

Thanks!
Reply With Quote
  #4  
Old 04-09-2011, 04:50 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 how to add rows to the article editor and have them show up in the article.
Reply With Quote
Reply

Thread Tools
Display Modes

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 12:35 AM.


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.03703 seconds
  • Memory Usage 2,292KB
  • 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_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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