Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-11-12 09:19:19

helmz
Member
Registered: 2010-09-14
Posts: 65

Hide pages from my site

How do I to show just the 3 pages I want to show and hide the rest, so people can’t see them. Thaniks in advance

Offline

#2 2010-11-12 14:51:37

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: Hide pages from my site

Depends on what you call a page and on your site’s structure. You can save articles as hidden, exclude sections and categories from your navigation, hide blocks and elements with txp:hide, show something only to logged in users via rvm_privileged …

… or take the other approach and display only links to articles you want to show.

Or any combination of the above. Depends.

Last edited by uli (2010-11-12 17:27:06)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2010-11-12 18:39:44

helmz
Member
Registered: 2010-09-14
Posts: 65

Re: Hide pages from my site

For example, my article 1 is showing in index.php but if u try to put:

/index.php?id=1 .. 2,3 etc

The pages doesnt show properly so I dont want people be able tp see it

Offline

#4 2010-11-12 22:02:06

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: Hide pages from my site

If I understand your last post you could try this code in your article form:

<txp:if_article_id id='1,2,3'>
	Put all necessary article tags here
<txp:else />
</txp:if_article_id>

In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#5 2010-11-16 10:37:15

helmz
Member
Registered: 2010-09-14
Posts: 65

Re: Hide pages from my site

Im getting: Tag error <txp:else />


<div class="text_area">
<div class="text">
<txp:article_custom id="2">
<h1 class="entry-title"><txp:title /></h1>
</div>
    <txp:if_article_id id='1,2,3'>
<p class="published"></p>
<div class="entry-content">
<div class="text_1"><txp:body /></div>
</div>
</txp:article_custom>
<div class="text_area2">
<div class="text2">
<txp:article limit="1" offset="1" >
<h1 class="entry-title"><txp:title /></h1>
</div>
<p class="published"></p>
<div class="entry-content">
<div class="text_2"><txp:body />
</div></div>
</txp:article>
    <txp:else />
</txp:if_article_id>
</div>

Last edited by helmz (2010-11-16 10:37:31)

Offline

#6 2010-11-16 14:25:40

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Hide pages from my site

Let’s see. By indenting the code, it’s pretty easy to see the problem areas.

<div class="text_area">
	<div class="text">
		<txp:article_custom id="2">
			<h1 class="entry-title">
				<txp:title />
			</h1>
			</div>
			<txp:if_article_id id='1,2,3'>
				<p class="published"></p>
				<div class="entry-content">
					<div class="text_1">
						<txp:body />
					</div>
				</div>
		</txp:article_custom>

<div class=“text_area2”> <div class=“text2”> <txp:article limit=“1” offset=“1” > <h1 class=“entry-title”> <txp:title /> </h1> </div> <p class=“published”></p> <div class=“entry-content”> <div class=“text_2”> <txp:body /> </div> </div> </txp:article> <txp:else />
</txp:if_article_id> </div>

Basically you have open <txp:if_article_id> opening there, and then closing pair that is out the block the starting that was defined in. In TXP you have to end the current block before starting new one.

There really isn’t any reason for the <txp:if_article_id> in the first place, not where it is placed. After all, the <txp:article_custom id="2"> is always getting article with ID#2 so it’s counter productive check if the article is ID#2.

So, remove the <txp:if_article> and the orphaned closing pair and <txp:else />, or put it inside the <txp:article /> or somewhere where the article ID can dynamically change.

Now, back to the original topic. I see that you want to hide inidividual article pages. Well, if you really want to kill the page and return error page (404 not found etc) then, yes, you can do that. For example you could use at the top your page template something like:

<txp:if_individual_article>
	<txp:if_article_id id="2">
		<txp:txp_die />
	</txp:if_article_id>
</txp:if_individual_article>

Tags used:

Or if you just want to remove articles from the site, then just change the article’s status to draft or something.

Last edited by Gocom (2010-11-16 14:38:40)

Offline

#7 2010-11-17 09:20:34

helmz
Member
Registered: 2010-09-14
Posts: 65

Re: Hide pages from my site

Hi Gocom, and thanks for your answer, by the way I tryed your last code to get 404 not found but I still see the page, maybe is it wrong? when you mean top its head?

Offline

Board footer

Powered by FluxBB