Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-03-17 22:48:46

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Links page / linklog / list of link categories / organizing links

I was using mem_glinklog and rss_linkcat_list to archive and organize my links, and figured I could do it now with built-in tags (and maybe some additional conditionals), however can’t quite figure how I’m to link to link_categories or anything else link-related.

My searches for guidance have come to no avail; quite possibly I’m using the wrong terminology and if someone could just clue me then I’ll find the answers all waiting.


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#2 2017-03-17 23:15:51

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Links page / linklog / list of link categories / organizing links

How did you want to link to them? With an #anchor?

Like in the other thread on archives, you could use txp:linklist sorted via category and use

<txp:if_different><h3 id="<txp:link_category />"><txp:link_category title="1" /></h3>

to output the headings with a hashtag.

Or alternatively you could use txp:category_list with type="category" as a wrapper and then txp:linklist within each loop using the category as a tag-in-tag.

If you want to display separate linklists per page, you’ll need to pass an url variable with your link, i.e. /links-section?linkcat=my-category use something like adi_gps to detect the url variable. You can then plug that into your txp:linklist as the category='<txp:variable name="linkcat" />' attribute to filter the output by category.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2017-03-17 23:45:04

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: Links page / linklog / list of link categories / organizing links

Thank you this is really helpful — I didn’t particularly miss something then. I can come up with something from this, thanks!


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#4 2017-03-18 00:13:12

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: Links page / linklog / list of link categories / organizing links

I think I don’t understand txp:category_list.. Does that require that I’ve created a section called “category”? because that seems to be the automatic link structure built into it.. /“category”/“link”/namesofcategories/ I didn’t know Textpattern could handle that kind of section/category/(category) url structure without something like sgb_url_handler?

See Sandbox for the following’s output

<h3>category_list thissection is 1</h3>
<txp:category_list type="link" wraptag="ul" break="li" thissection="1" />

<h3>category_list thissection is 0 (limit 3)</h3>
<txp:category_list type="link" wraptag="ul" break="li" thissection="0" limit="3" />

<h3>linklist w/ if_different</h3>
<ul><txp:linklist sort="category">
<txp:if_different><li><txp:link_category title="1" /></li></txp:if_different>
</txp:linklist></ul>

<h3>rss_linkcat_list</h3>
<txp:rss_linkcat_list linktosection="links" showcount="1" />

textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#5 2017-03-18 10:37:08

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Links page / linklog / list of link categories / organizing links

Leaving aside the link count for the moment, you could do either this using txp:linklist:

<txp:linklist sort="category" wraptag="ul">
    <txp:if_different>
        <li>
            <a href="/link?c=<txp:link_category />">
                <txp:link_category title="1" />
            </a>
        </li>
     </txp:if_different>
</txp:linklist>

or this using txp:category_list:

<txp:category_list type="link" parent="parent-cat" exclude="parent-cat" wraptag="ul">
        <li>
            <a href="/link?c=<txp:category />">
                <txp:category title="1" />
            </a>
        </li>
</txp:category_list>

The latter will list all child link categories of parent-cat including those you might have created but might not have an actual link assigned to them.

I’m not sure about link counts but I’m sure someone will have a clever answer to that.

Category handling is not automatic on a custom section such as links, so on the landing page, try using <txp:if_category>… to detect whether a category is set, and then output the corresponding linklist filtered to that category.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2017-03-18 11:57:43

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Links page / linklog / list of link categories / organizing links

alicson wrote #304873:

I think I don’t understand txp:category_list.. Does that require that I’ve created a section called “category”? because that seems to be the automatic link structure built into it.. /“category”/“link”/namesofcategories/ I didn’t know Textpattern could handle that kind of section/category/(category) url structure without something like sgb_url_handler?

Textpattern translates /(localized)category/link/namesofcategories/ as “link-type category namesofcategories”, at least in theory.

Offline

#7 2017-03-19 01:29:45

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

Re: Links page / linklog / list of link categories / organizing links

And that said, you can also change the hardcoded part by modifying L10n string named category. Tho, if you do, it will also modify any other place that might use the string.

Offline

#8 2017-03-22 20:10:14

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: Links page / linklog / list of link categories / organizing links

<txp:category_list type="link" /> automatically generates links to each of the (link)category headers; those links produce the link structure I mentioned above /category/link/namesofcategories/ — however /category/ (let alone /category/link/) are not real pages(?); it all links to my front page, which is not a good thing as I already have a bunch of sections running through my default page; can’t I direct it to use a different template?

Meanwhile, this seems to be the solution:
<a href="/links/?c=<txp:category />"><txp:category title="1" /></a>

*update: missed a slash before the ?

Last edited by alicson (2017-03-22 20:29:54)


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#9 2017-03-22 20:39:38

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Links page / linklog / list of link categories / organizing links

Hi Alicson,

alicson wrote #304973:

however /category/ (let alone /category/link/somecat) are not real pages(?);

No, they are not. It’s just an equivalent of ?c=somecat&context=link; you do whatever you want with it, like:

<txp:if_category>
    <!-- call "link-mycat" form -->
    <txp:output_form form='<txp:page_url type="context" />-<txp:category />' />
</txp:if_category>

Offline

#10 2017-03-22 21:28:30

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: Links page / linklog / list of link categories / organizing links

Some of the link categories are working and some are not. I’ve checked the contents and tried re-saving links to update them, etc… have not yet found the distinguishing factor that allows one category to show perfectly with all its links, and another category results in 404. No difference when I turned off all plugins.

Last edited by alicson (2017-03-22 21:28:48)


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#11 2017-03-22 21:35:16

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: Links page / linklog / list of link categories / organizing links

etc wrote #304974:

It’s just an equivalent of ?c=somecat&context=link; you do whatever you want with it, like:

<txp:if_category>
    <!-- call "link-mycat" form -->
    <txp:output_form form='<txp:page_url type="context" />-<txp:category />' />
</txp:if_category

Ah interesting; okay, thanks. Shouldn’t that be an existing form, then? So that people (like me) can make sense of it and redirect/change the form?


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#12 2017-03-22 21:51:18

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Links page / linklog / list of link categories / organizing links

alicson wrote #304977:

Some of the link categories are working and some are not. I’ve checked the contents and tried re-saving links to update them, etc… have not yet found the distinguishing factor that allows one category to show perfectly with all its links, and another category results in 404. No difference when I turned off all plugins.

My guess would be that an url like ferrydust.com/links/?c=cool does not set link content, so txp searches cool in article categories, not found, 404… To check it, go to ferrydust.com/links/?c=cool&context=link.

Offline

Board footer

Powered by FluxBB