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&type=newcontent&sectionid={vb:raw nodeid}&days=120&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>
</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?