Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-04-25 08:21:52

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Problem in displaying articles from category list

I profit a complex script, in a index page, allowing the visitors of my site to choose a category in a list of categories to have a group of articles displayed (every list of articles matches a specific category).

When, ‘opening’ a certain category, a certain list of articles displays, the page shift upwards (while the article list is at the bottom of the page).

Because of this problem, the visitor of the page, who aims to have a certain article list displayed, need to move the lateral bar to reach the list and then select the article he want read.

————-

What I need is to get all the links act something like to what occurs in a Html page, where I profit the following expression:

<ul>
	  <li><a href="#01">Article list 1</a>
	  <li><a href="#02">Article list 2</a>
	  <li><a href="#03">Article list 3</a>
</ul> 


<p><a id="01">List1</a></p>

<p><a id="02">List1</a></p>

<p><a id="03">List1</a></p>

—————————

The script I utilize to list the article categories, at now, is:

<txp:category_list parent='<txp:section />' exclude='<txp:section />' wraptag="p" break="p" children="0" active_class="activecategory" type="article">

<p><b>-></b> <a class="titoloart" href="<txp:site_url /><txp:section />/?c=<txp:category />"><txp:category title="1" /></a></p> 

<txp:if_category name='<txp:category />'>

<txp:article_custom category='<txp:category />' Custom_field_name="abcdefg" sort="Posted desc" break="p" limit="35">
<txp:permlink><txp:title /></txp:permlink> - <i>Date:</i> <txp:posted wraptag="em" />
</txp:article_custom>

</txp:if_category>

</txp:category_list>

—————————————————

Thanks for paying attention to this complex issue.

(added bc.. for better code display. -Els)

Last edited by els (2013-04-25 21:38:29)

Offline

#2 2013-05-02 23:48:12

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: Problem in displaying articles from category list

Maybe my antecedent question can be more easily understood in these terms:

Is there any default way, in Textpatter, in order to get a redirection to the top of an article as i can get in HTML, clicking an
<a href=”#1”> link</a> —-> redirection at the beginning of an article that contains the TAG

<a id=“1”>Article top</a>

— I’m trying to add this feature to the list of articles that displayes by means of the category list I can get through the expression I wrote in the antecedent post. —

Thanks for the patience ;)

Offline

#3 2013-05-03 12:30:44

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

Re: Problem in displaying articles from category list

The questions you’ve asked are slightly different. I’ll start with the more fundamental one, the one in the second post:
On your page you need two article/_custom tags with identical attribute values entered. Inside the first one’s container (or queried form) you put

<a href="#<txp:article_id />"><txp:title /></a>

(Replace <txp:title /> with whatever you need there.)
Inside the second one you put:

<a id="<txp:article_id />"><txp:title /></a>

But the HTML code example of your first post implies that you might have lists of articles and want to skip to the first article of each list. In order to obtain this, you’d use the above code fragments and wrap each of them with additional <txp:if_first_article> tags, so only the first article in each list is provided with a skip link. Sorry, that’s crap. No idea ATM.

If there are several types of lists on your page (e.g. link lists plus article lists, which then might hold identical IDs), you could prefix the IDs differently, like

<a href="#article_<txp:article_id />"><txp:title /></a>

Last edited by uli (2013-05-03 12:40:03)


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

Offline

#4 2013-05-04 01:39:15

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: Problem in displaying articles from category list

Thanks, I have read your clear answer and I realize the question is slightly different.

You answer is anyway useful because I’ve learned something more, but I can’t still understand how to reach the solution for my first question, because I need to get an automatic recall of the top of each list of category-articles, displayed selecting each one of the category-link, listed by <txp:category_list /> in every channel of my site.

Thanks

Last edited by Bongo-man (2013-05-04 01:40:24)

Offline

#5 2013-05-06 12:59:54

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

Re: Problem in displaying articles from category list

Bongoman, have you tried whether you get anything working with my code?

Looking at your TXP code again I think the if_first_article method applied in your code might not be as crappy as I thought cause every list created by your tags should actually be a new article list, hence the if_first_article filter is applied to each first article in that list, outputting one skip link ID per list.


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

Offline

#6 2013-05-07 09:06:39

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: Problem in displaying articles from category list

I’ ve tried again last night with no outcome.

Maybe my question was not so clear at the beginning.

The problem is that I can’t link an article id placing the <a href id=<txp:article_id />around a category.
That because my code above generates a list of article categories; then selecting one of them you make a list of article titles expand displaying some titles.

The actual problem is that this title list displays not in the center of the screen, so you must scroll the page to see this list.

I’ve tried also <txp:if_first_article /> also with no result.

Last edited by Bongo-man (2013-05-07 09:26:09)

Offline

#7 2013-05-08 12:40:56

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

Re: Problem in displaying articles from category list

Bongo-man wrote:

The problem is that I can’t link an article id placing the <a href id=<txp:article_id />around a category.

Yes, article_id is meant to be placed in an article form.

So your code needed to look like this:

<txp:category_list parent='<txp:section />' exclude='<txp:section />' wraptag="p" break="p" children="0" active_class="activecategory" type="article">

<p><b>-></b> <a class="titoloart" href="<txp:site_url /><txp:section />/?c=<txp:category />"><txp:category title="1" /></a></p> 

<txp:if_category name='<txp:category />'>

<txp:article_custom category='<txp:category />' Custom_field_name="abcdefg" sort="Posted desc" break="p" limit="35">
<txp:if_first_article><a id="<txp:article_id />"><txp:title /></a></txp:if_first_article><!-- NEW, FOR CREATING ARTICLE IDs -->
<txp:permlink><txp:title /></txp:permlink> - <i>Date:</i> <txp:posted wraptag="em" />
</txp:article_custom>

</txp:if_category>

</txp:category_list>

And above, on the top of the page, you’d need an altered copy of that code in order to create the links:

<txp:category_list parent='<txp:section />' exclude='<txp:section />' wraptag="p" break="p" children="0" active_class="activecategory" type="article"> 

<txp:if_category name='<txp:category />'>

<txp:article_custom category='<txp:category />' Custom_field_name="abcdefg" sort="Posted desc" break="p" limit="35">
<txp:if_first_article><a href="#<txp:article_id />"><txp:title /></a></txp:if_first_article><!-- NEW CODE FOR CREATING THE SKIP LINKS, PREVIOUS TAGS REMOVED -->
</txp:article_custom>

</txp:if_category>

</txp:category_list>

But I’m moving on thin ice here, I’ve not a tag parser brain. If it doesn’t work immediately, it might help to get you there to a certain extent.


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

Offline

Board footer

Powered by FluxBB