vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   vBulletin CMS Widgets - Remove Primary Content Widget (https://vborg.vbsupport.ru/showthread.php?t=268658)

tommyxv 08-16-2011 10:00 PM

Remove Primary Content Widget
 
1 Attachment(s)
This is for removing the primary content widget from the CMS homepage/index and keeping it only on the pages you desire.

Only Admins will be able to see it on the CMS homepage/index for page setting purposes. Just put your mouse where the primary content box would be and you will see the edit pencil image come up.

Many thanks to Lynne for the help.

You MUST change the variables to the names of your pages.

Examples:

MY SITE URL/content.php?1-home
1-home is my CMS index so I would change 1-name_here to 1-home and the first line would look like:
Code:

<vb:if condition="$_GET['r'] == '1-home' OR !$_GET['r']">

MY SITE URL/content.php?2-docs
2-docs is one of my CMS pages so I would change x-name_here to 2-docs and the line would look like:
Code:

<vb:if condition="$_GET['r'] == '2-docs'">
If you have multiple pages then the line above will look something like this:
Code:

<vb:if condition="$_GET['r'] == '2-docs' OR '3-pagename' OR '4-pagename'">



1) Find the vbcms_content_section_page template

2) Replace contents with this. (You MUST change the variables to the names of your pages as shown in the examples above)

Code:

<vb:if condition="$_GET['r'] == '1-name_here' OR !$_GET['r']">
<vb:if condition="is_member_of($vbulletin->userinfo, 6)">



{vb:raw css}

        <div class="title" align="right">
       
                <vb:if condition="$can_publish">
                                <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>
                      </div>


</vb:if>
</vb:if>

<vb:if condition="$_GET['r'] == 'x-name_here'">


{vb:raw css}

        <div class="title">
        <!-- section page title div -->
                <h1 class="header">
                        <span>{vb:raw title}</span>
                        <vb:if condition="$can_publish">
                                <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>
                        <vb:if condition="$vboptions['externalrss']">
                                <a href="external.php?do=rss&amp;type=newcontent&amp;sectionid={vb:raw nodeid}&amp;days=120&amp;count=10"><img src="{vb:stylevar imgdir_misc}/rss_40b.png" alt="{vb:rawphrase rss_feed}" /></a>
                        </vb:if>
                </h1>
                <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:else if condition="$publishdate" />
                        <vb:comment>
                                {vb:rawphrase published_on_x {vb:raw publishdatelocal}}  {vb:raw publishtimelocal}
                        </vb:comment>
                </vb:if>

        </div>
        <!-- closes section page title div -->
        <vb:if condition="$filter_unpublished_url">
                <a href="{vb:raw filter_unpublished_url}">{vb:rawphrase filter_phrase}</a>
        </vb:if>

        <div id="section_content">
                {vb:raw content}
<vb:comment Removed>
        <vb:if condition="!$no_results_phrase AND $showall">
                <div class="fullwidth">
                        <a class="viewall" href="{vb:raw section_list_url}">{vb:rawphrase view_all}</a>
                </div>
        </vb:if>
</vb:comment>
        <hr class="none" />
        </div>

        <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", "section_content", {vb:raw vboptions.lightboxenabled});
                //-->
                </script>
        </vb:if>

        <vb:if condition="$no_results_phrase">
        <div class="fullwidth">
                <p class="cms_article_txt_content">
                        {vb:raw no_results_phrase}
                </p>
        </div>
        </vb:if>

<vb:if condition="$pagenav">
        <div id="below_contentlist" class="fullwidth">
                {vb:raw pagenav}
        </div>
</vb:if>

</vb:if>



UPDATED CONDITIONAL STATEMENT TO SHOW THE EDIT PENCIL AGAIN TO ADMINS Tested and working in 4.2.1.

Was:
Code:

<vb:if condition="is_member_of($bbuserinfo, 6)">
Updated to:
Code:

<vb:if condition="is_member_of($vbulletin->userinfo, 6)">

Please mark 'Installed' if you are using this template edit. I will be happy to help if you are having problems getting it working.

tommyxv 08-22-2011 05:04 AM

FYI: This also works in 4.1.5 too.

Wayne Luke 08-24-2011 06:55 PM

A couple of changes are needed...

In your first conditional, you need to close the <div> that aligns everything to the right.

In your second conditional, that should be != instead of ==. As written it shows the primary for the one you want to hide it with and doesn't show it on any others.

tommyxv 08-24-2011 10:35 PM

Quote:

Originally Posted by Wayne Luke (Post 2237576)
A couple of changes are needed...

In your first conditional, you need to close the <div> that aligns everything to the right.

In your second conditional, that should be != instead of ==. As written it shows the primary for the one you want to hide it with and doesn't show it on any others.

Thanks for the looking at this edit. I added the closing </div>.

I am a little confused with the "!= instead of ==". I tried it but that caused the primary content widget to show on the index to all, and not on my other pages at all. For now I will leave it as is since it is working for me.

I did try using the <vb:elseif condition> and <vb:else /> to make it a bit cleaner, but it did not work.

Wayne Luke 08-25-2011 04:23 PM

For the second issue, I guess it depends on what you put for x-name-here. I used my 1-box-office value as that is what my home page is called. So it only showed the primary content on the homepage without showing it elsewhere.

Good job though. Much better than my previous method which was to stick it in a widget area and then use CSS to hide that area.

dbetanco 08-31-2011 03:38 AM

no idea about how to use this... sorry my comment.. i'm newbie. where i have to perform this steps???

tommyxv 09-01-2011 04:27 AM

Quote:

Originally Posted by dbetanco (Post 2240273)
no idea about how to use this... sorry my comment.. i'm newbie. where i have to perform this steps???


You are replacing the vbcms_content_section_page template with the code I have posted. The text in red are the variables in which you have to change as they are unique to your site.

Link me to your site so I can see your page names and we'll go from there.

pmflav1 09-21-2011 11:29 AM

Great stuff thankyou

tommyxv 10-09-2011 10:13 PM

Cool, thanks.

Jokorey 11-03-2011 03:51 PM

Awesome, thanks!

Jokorey 11-03-2011 06:29 PM

Hrm, I am having a problem, and not sure what is happening.

Code:

<vb:if condition="$_GET['r'] == '120-change-the-world' OR '121-clients' OR '122-directory' OR '124-news_1' OR '128-human-resources' OR '129-GGOB' OR '130-resources' OR '131-education'">
As soon as I add any "OR 'X'" to the code, the "Primary Content" returns on the 1-home page. If I just have any of the pages listed singular, it's works as expected, hiding the PC on all the other pages that aren't listed.

The end result I am shooting for is to have the PC hidden on 1-home, and visible on all the others. Any ideas?

GamersChallenge 11-05-2011 06:34 PM

Quote:

Originally Posted by Jokorey (Post 2264157)
Hrm, I am having a problem, and not sure what is happening.

Code:

<vb:if condition="$_GET['r'] == '120-change-the-world' OR '121-clients' OR '122-directory' OR '124-news_1' OR '128-human-resources' OR '129-GGOB' OR '130-resources' OR '131-education'">
As soon as I add any "OR 'X'" to the code, the "Primary Content" returns on the 1-home page. If I just have any of the pages listed singular, it's works as expected, hiding the PC on all the other pages that aren't listed.

The end result I am shooting for is to have the PC hidden on 1-home, and visible on all the others. Any ideas?

I'm having the same problem.

Jokorey 11-28-2011 06:11 PM

Gamers - I was never able to get this particular solution to work, but Wayne_Luke's (over on vbulletin.com) is getting the job done for me - might check it out if you haven't.

GamersChallenge 12-18-2011 03:07 PM

thanks jokorey, I founded and it works.

so easy, how did I not think of that?

for anyone else looking for this you can find it here, https://www.vbulletin.com/forum/show...-in-a-section?

thejohnnybrown 01-06-2012 12:16 AM

If (like me) all you want is to remove the primary content widget from all pages, just do this:

1) Find the vbcms_content_section_page template.

2) Enclose everything in between: <vb:comment> . . . </vb:comment> (comment it all out)

tommyxv 02-03-2012 07:04 AM

I just did this on a new v4.1.10 install and it is still working for me. Are you still have problems?

4ibon4ik 03-27-2012 07:49 AM

4.1.11 my working vbcms_content_section_page template

PHP Code:

<vb:if condition="$_GET['r'] == '1-Home' OR !$_GET['r']">
<
vb:if condition="is_member_of($bbuserinfo, 6)">


{
vb:raw css}

    <
div class="title" align="right">
    
        <
vb:if condition="$can_publish">
                <
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>
                      </
div>


</
vb:if>


<
vb:else if condition="$_GET['r'] > '1-Home'"/>
{
vb:raw css}

    <
div class="title">
    <!-- 
section page title div -->
        <
h1 class="header">
            <
span>{vb:raw title}</span>
            <
vb:if condition="$can_publish">
                <
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>
            <
vb:if condition="$vboptions['externalrss']">
                <
a href="external.php?do=rss&amp;type=newcontent&amp;sectionid={vb:raw nodeid}&amp;days=120&amp;count=10"><img src="{vb:stylevar imgdir_misc}/rss_40b.png" alt="{vb:rawphrase rss_feed}" /></a>
            </
vb:if>
        </
h1>
        <
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:else if condition="$publishdate/>
            <
vb:comment>
                {
vb:rawphrase published_on_x {vb:raw publishdatelocal}}  {vb:raw publishtimelocal}
            </
vb:comment>
        </
vb:if>

    </
div>
    <!-- 
closes section page title div -->
    <
vb:if condition="$filter_unpublished_url">
        <
a href="{vb:raw filter_unpublished_url}">{vb:rawphrase filter_phrase}</a>
    </
vb:if>

    <
div id="section_content">
        {
vb:raw content}
<
vb:comment Removed>
    <
vb:if condition="!$no_results_phrase AND $showall">
        <
div class="fullwidth">
            <
class="viewall" href="{vb:raw section_list_url}">{vb:rawphrase view_all}</a>
        </
div>
    </
vb:if>
</
vb:comment>
    <
hr class="none" />
    </
div>

    <
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""section_content", {vb:raw vboptions.lightboxenabled});
        
//-->
        
</script>
    </
vb:if>

    <
vb:if condition="$no_results_phrase">
    <
div class="fullwidth">
        <
class="cms_article_txt_content">
            {
vb:raw no_results_phrase}
        </
p>
    </
div>
    </
vb:if>

<
vb:if condition="$pagenav">
    <
div id="below_contentlist" class="fullwidth">
        {
vb:raw pagenav}
    </
div>
</
vb:if>
</
vb:if> 


Savraj 05-10-2012 09:21 AM

Hi someone tell me how to find the vbcms_content_section_page template...please

Sherrie 01-21-2013 10:31 AM

Hello, is this still an issue in 4.2? I'd hate to think that after moving all of my main pages to the CMS I will now get penalised for cloaking? I looked at the layouts and primary content looks to be the main content of the page? but it doesn't appear to be called a widget?

This is the first time I have used any kind of CMS on my site.

tommyxv 01-23-2013 04:17 PM

Quote:

Originally Posted by Sherrie (Post 2398363)
Hello, is this still an issue in 4.2? I'd hate to think that after moving all of my main pages to the CMS I will now get penalised for cloaking? I looked at the layouts and primary content looks to be the main content of the page? but it doesn't appear to be called a widget?

This is the first time I have used any kind of CMS on my site.

Yes, you can still use this for 4.2.x

BattleBunker 08-15-2013 01:27 AM

Slightly old topic now, but its the best thing (and most recent) I've found in hours of searching on how to remove the primary content from specific pages.


I had listed some questions a short time ago, but have managed to answer them both myself. Here are the questions I asked:


1 - can this be done in the reverse - ie: list the pages you do NOT want to show the PC on, rather then list the pages you want to KEEP the PC on ....
2 - is this "removing" the PC from the page, or 'cloaking' it ...
3 - this does not work when listing multiple pages using OR as per the original post (also posted by Jokorey and GamersChallenge, though they seemed to find another solution that suited their needs)


Here are my solutions to issue 1 and 3 - not being a programmer I am unsure if they are 'best practice' but the edits seem to work fine:


Issue 1
Reversing the method - list the pages you want to HIDE the content on, instead of listing the pages your want to SHOW the content on:

Simply change the 'connector' (or what ever it is called) to "not equal too", ie:

PHP Code:

<vb:if condition="$_GET['r'] == '1-Home' OR !$_GET['r']"

to:

PHP Code:

<vb:if condition="$_GET['r'] !== '1-Home' OR !$_GET['r']"


Issue 3

Listing additional pages using OR as per the original topic does not work, you need to list additional 'if' statements:

I have done the following (keeping in mind I am listing pages I DO NOT want the primary content displayed on):

PHP Code:

<vb:if condition="$_GET['r'] !== '5-News' OR !$_GET['r']">
<
vb:if condition="$_GET['r'] !== '11-food' OR !$_GET['r']"

As I have added an additional IF statement, I need to close/end that statement, so added an additional </vb:if> ... here is the full code for the first part:

PHP Code:

<vb:if condition="$_GET['r'] !== '5-News' OR !$_GET['r']">
<
vb:if condition="$_GET['r'] !== '11-food' OR !$_GET['r']">
<
vb:if condition="is_member_of($bbuserinfo, 6)">


{
vb:raw css}

    <
div class="title" align="right">
    
        <
vb:if condition="$can_publish">
                <
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>
                      </
div>


</
vb:if>
</
vb:if>
</
vb:if> 


Note my additional IF statement on the second line, and my additional </vb:if> on the last line


Given that I have now included multiple pages using IF statements, I need to include those pages further on too, the next section immediately after the 3 closing IF 'statements'. So now I have:

PHP Code:

<vb:if condition="$_GET['r'] !== '5-News'">
<
vb:if condition="$_GET['r'] !== '3-video-games'"

Again, given that I have include an additional IF statement here, I need to close it somewhere ... I simple closed it at the very end by adding an additional </vb:if> as the very last line in the entire code.

Long post, sorry - trying to be as descriptive as possible

Here is my entire code, that now hides the Primary Content on the pages I list, and allows me to hide that content on (in this case) 2 pages ... News and Food:

PHP Code:

<vb:if condition="$_GET['r'] !== '5-News' OR !$_GET['r']">
<
vb:if condition="$_GET['r'] !== '11-food' OR !$_GET['r']">
<
vb:if condition="is_member_of($bbuserinfo, 6)">


{
vb:raw css}

    <
div class="title" align="right">
    
        <
vb:if condition="$can_publish">
                <
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>
                      </
div>


</
vb:if>
</
vb:if>
</
vb:if>

<
vb:if condition="$_GET['r'] !== '5-News'">
<
vb:if condition="$_GET['r'] !== '11-food'">

{
vb:raw css}

    <
div class="title">
    <!-- 
section page title div -->
        <
h1 class="header">
            <
span>{vb:raw title}</span>
            <
vb:if condition="$can_publish">
                <
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>
            <
vb:if condition="$vboptions['externalrss']">
                <
a href="external.php?do=rss&amp;type=newcontent&amp;sectionid={vb:raw nodeid}&amp;days=120&amp;count=10"><img src="{vb:stylevar imgdir_misc}/rss_40b.png" alt="{vb:rawphrase rss_feed}" /></a>
            </
vb:if>
        </
h1>
        <
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:else if condition="$publishdate/>
            <
vb:comment>
                {
vb:rawphrase published_on_x {vb:raw publishdatelocal}}  {vb:raw publishtimelocal}
            </
vb:comment>
        </
vb:if>

    </
div>
    <!-- 
closes section page title div -->
    <
vb:if condition="$filter_unpublished_url">
        <
a href="{vb:raw filter_unpublished_url}">{vb:rawphrase filter_phrase}</a>
    </
vb:if>

    <
div id="section_content">
        {
vb:raw content}
<
vb:comment Removed>
    <
vb:if condition="!$no_results_phrase AND $showall">
        <
div class="fullwidth">
            <
class="viewall" href="{vb:raw section_list_url}">{vb:rawphrase view_all}</a>
        </
div>
    </
vb:if>
</
vb:comment>
    <
hr class="none" />
    </
div>

    <
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""section_content", {vb:raw vboptions.lightboxenabled});
        
//-->
        
</script>
    </
vb:if>

    <
vb:if condition="$no_results_phrase">
    <
div class="fullwidth">
        <
class="cms_article_txt_content">
            {
vb:raw no_results_phrase}
        </
p>
    </
div>
    </
vb:if>

<
vb:if condition="$pagenav">
    <
div id="below_contentlist" class="fullwidth">
        {
vb:raw pagenav}
    </
div>
</
vb:if>

</
vb:if>
</
vb:if> 



What still remains though, is the Issue 2 - does this 'remove' the content, or 'cloak' it ...? I guess the question is, am I going to be dinged by search engines for cloaking content?

BattleBunker 08-15-2013 10:33 PM

Okay, after stumbling around for most of yesterday I have not been able to get this to work, either as suggested by the OP or by my edits above.

- Using OR does not work
- By including several IF statements that do NOT include the PC on various pages, I cannot turn it off on the main content.php page
- adding additional IF statements to only show it on specific pages does not work either

Off to find a different solution.

Cheers

tommyxv 08-30-2013 03:09 AM

Hi, I still have this working on one of my sites. What version vb are you running? I would not consider this cloaking. Using css to hide I feel is cloaking.


All times are GMT. The time now is 05:49 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.01525 seconds
  • Memory Usage 1,934KB
  • 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
  • (8)bbcode_code_printable
  • (7)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (23)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