Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Archives
  3. » [archived] mkp_header_link

#1 2005-06-07 17:10:21

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

[archived] mkp_header_link

Notice: this thread is archived, see <txp:feed_link />

******************************************

Author: Michael Pate
Author URL: http://www.cmsstyles.com/

Name: mkp_header_link
Version: 0.93
Modified: 2005-06-08
<a href=“http://download.cmsstyles.com/details.php?file=3”>Download URL</a>
<a href=“http://www.cmsstyles.com/plugins/mkp_header_link-0.93.txt”>Paste URL</a>
<a href=“http://cmsstyles.com/txp/154/header-link-for-txp”>More Information</a>

Summary: Creates a link to feed for use in the header portion of an xhtml page

Last edited by els (2009-04-24 17:41:20)

Offline

#2 2005-06-07 22:02:26

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: [archived] mkp_header_link

Works, fine michael,I’ve been wondering about this allso, and my thought first was that there is a tag somewhere allready in Textpattern.
One suggestion though,adding a section attribute would be usefull.(That’s the way I am just hardcoding it for my site so I can serve up individual feeds for each of my main sections.)
By the way,I allso installed your previous plug(version),and guess what,yes I am using it.
I think making these plugins is a nice way to learn some php.
So, congratulations,fellow.

regards, marios


⌃ ⇧ < ⌃ ⇧ >

Offline

#3 2005-06-08 03:11:43

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: [archived] mkp_header_link

I have a version working now that is section-aware so you can use it to create a link to the feed for the current section. But I also want to add a way to link to a section feed from outside the section. Look for it sometime in the next 12-18 hours.

Update: Well, actually it turned out to be a lot simpler than I originally thought.

Last edited by michaelkpate (2005-06-08 03:48:15)

Offline

#4 2005-06-08 07:45:25

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: [archived] mkp_header_link

I’ll be arround,

regards, marios


⌃ ⇧ < ⌃ ⇧ >

Offline

#5 2005-06-08 16:40:36

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: [archived] mkp_header_link

I decided that I had overload the syntax way too much for mkp_header_link so I returned it to the original version. Now, if you want to link to a section use mkp_section_header_link. If a section is not specified, it automatically links to the current section.

Offline

#6 2005-06-08 18:10:48

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: [archived] mkp_header_link

Great, super, I’ll test that out ASAP,

regards,marios


⌃ ⇧ < ⌃ ⇧ >

Offline

#7 2005-06-16 14:11:02

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: [archived] mkp_header_link

I couldn’t get this yet getting to work after upgrading to v0.93.
It is outputting something like that in the source:
<code>
<link rel=“alternate” type=“application/atom+xml” title=“houston Atom 0.3” href=“http://local.cybermarios7.com/?atom=1&section=houston” />
</code>
It should print though something like that:
<code>

<link rel=“alternate” type=“application/atom+xml” href=“http://[TLD]/[sectionname]/?atom=1” title=“Atom 0.3 feed” />
</code>
I don’t have any programming skills, but I’ll take a look at the source code if I have some time.
I used the tag :

<code>
<txp:mkp_section_header_link flavor=“atom” section=“houston” />
</code>

regards, marios

Last edited by marios (2005-06-16 14:25:16)


⌃ ⇧ < ⌃ ⇧ >

Offline

#8 2005-06-16 14:57:50

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: [archived] mkp_header_link

Looking at the bottom of the code at the mkp section header function the string concatenation for the generation of the section meta tag is wrong.
I temporarely changed the code by removing the sitesection function and appending the sitefunction after the ‘hu’ string. to this.
<code>
function mkp_section_header_link($atts) { extract(lAtts(array( ‘flavor’ => ‘rss’, ‘section’ => ‘’ ),$atts));

$section = (!($section)) ? $GLOBALS[“s”] : $section;

$rs = safe_row(“title”,“txp_section”,“name = ‘$section’ limit 1”); $sectionname = (empty($rs[“title”])) ? $s.’ ‘ : $rs[“title”].’ ‘; $sitesection = a.‘section=’.urlencode($section);

if($flavor==‘atom’) { $out = ‘<link rel=“alternate” type=“application/atom+xml” ‘ .‘title=”’.$sectionname.‘Atom 0.3” href=”’.hu.$section.’?’.$flavor.’=1’.’” />’; } else { $out = ‘<link rel=“alternate” type=“application/rss+xml” ‘ .‘title=”’.$sectionname.‘RSS 0.92” href=”’.hu.$section.’?’.$flavor.’=1’.’” />’; }

return $out; }
</code>

This fixes the problem for the wrong url string generation, but I didn’t have time to study the whole plugin.

regards, marios

Last edited by marios (2005-06-16 14:59:45)


⌃ ⇧ < ⌃ ⇧ >

Offline

#9 2005-06-16 15:49:17

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: [archived] mkp_header_link

One word of notice on the default behavior of
<code>
<txp:mkp_section_header_link flavor=“atom” />
</code>

If no section attribute is provided (e.g. using one page template for all sections it will use the page template name instead the section name)
which is a problem since it’ll give you the default name of your main template resulting in a meta tag that looks like this:
<code>
<link rel=“alternate” type=“application/rss+xml” title=“default RSS 0.92” href=“http://TLD/default?rss=1” />
</code>

So it should better use real section names or the string default should be stripped out or something.
And of course leaving the code like that the section names would need to match the template names.

regards, marios

Last edited by marios (2005-06-16 15:59:47)


⌃ ⇧ < ⌃ ⇧ >

Offline

  1. Index
  2. » Archives
  3. » [archived] mkp_header_link

Board footer

Powered by FluxBB