Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#49 2006-09-11 22:43:49

jeffbax
New Member
Registered: 2006-07-14
Posts: 3

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

Ok, so luckily I had the thing backed up locally (the code)

So I tried to recompile it myself and it seems to be working.

If anyone else wants it, you can get it from here:
http://www.andrew.cmu.edu/user/jbaxenda/other/beginning_jeff.tpp

Last edited by jeffbax (2006-09-11 22:44:36)

Offline

#50 2006-09-12 23:00:08

philipashlock
Member
From: Bellingham, Washington - USA
Registered: 2004-06-20
Posts: 58
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

Apologies again, the link has been updated.

Download Beginning 0.6

Offline

#51 2006-10-14 21:44:16

mazso
Member
Registered: 2005-09-29
Posts: 25

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

I’m working at a two language website using categories to seperate english and german content. The URLs look like this: www.domain.com/section/the-title/?c=en.

The problem: how can you achieve to add this parameter at the beginning-link?

Maybe I have to change something at the beginning-plugin?

No. Not at the beginning-plugin. I found a solution. You just have to alter line 1467 at taghandlers.php from

<code> return tag(parse($thing),‘a’,’ href=”’.$url.’” title=”’.gTxt(‘permanent_link’).’”’.
</code>

to

<code> return tag(parse($thing),‘a’,’ href=”’.$url.’/?c=<txp:category />” title=”’.gTxt(‘permanent_link’).’”’.
</code>

Thats all. But never forget to change it again after any Textpattern update.

Hope this will be helpful for someone.

Mazso

Last edited by mazso (2006-10-15 06:32:53)

Offline

#52 2006-10-19 11:57:08

Brutal
Member
Registered: 2005-01-28
Posts: 14

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

I can’t get this plugin to work properly (maybe because of the 4.0.4-update?)

Anyway, if i use only <txp:beginning /> , everything works fine. But as soon as I set some attributes I get errors.
For example:

<txp:beginning length=“250” format=“inside” linktext=“Read More” styleclass=“morelink” cfield=“continue” />

generates the following errors:

tag_error -> Textpattern Notice: Unknown tag attribute: length on line 582

tag_error -> Textpattern Notice: Unknown tag attribute: format on line 582

tag_error -> Textpattern Notice: Unknown tag attribute: linktext on line 582

tag_error -> Textpattern Notice: Unknown tag attribute: styleclass on line 582

tag_error -> Textpattern Notice: Unknown tag attribute: cfield on line 582

Last edited by Brutal (2006-10-19 11:59:23)

Offline

#53 2006-10-22 23:04:53

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

Brutal wrote:

I can’t get this plugin to work properly (maybe because of the 4.0.4-update?)

I’ve got the same problem, and i’m sure it’s because of the update, as i switched back to 4.0.3 and everything works well. Can anyone help?

Many thanks


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#54 2006-10-23 06:02:08

philipashlock
Member
From: Bellingham, Washington - USA
Registered: 2004-06-20
Posts: 58
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

I’ve updated the plugin (it was using a deprecated method to extract attributes).

Could you please test this out for me on 4.0.4 before I update it everywhere else? I’d really appreciate the help there as I’ve yet to update any of my installations

Beginning 0.7

Last edited by philipashlock (2006-10-23 09:33:17)

Offline

#55 2006-10-23 07:12:58

Brutal
Member
Registered: 2005-01-28
Posts: 14

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

Hmm.. I still get the same errors

Offline

#56 2006-10-23 08:05:01

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

me too… :(


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#57 2006-10-23 08:30:02

philipashlock
Member
From: Bellingham, Washington - USA
Registered: 2004-06-20
Posts: 58
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

I went ahead and installed 4.0.4 on a development server and saw the error messages, but also saw that the plugin was working fine. The error messages look like they’re a false negative because nothing is failing with the actual functionality of the plugin or the tag. You can suppress these error messages by changing the Production Status of your website under:

Admin -> Preferences -> Production Status -> set to Live

I’ll look into the problem further so that the error message don’t come up at all. Let me know if your experience differs from mine in the actual functionality of the plugin despite the error messages.

Offline

#58 2006-10-23 09:30:30

philipashlock
Member
From: Bellingham, Washington - USA
Registered: 2004-06-20
Posts: 58
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

Ok, go ahead and try again. I’ve verified this to work:

Beginning 0.7

This required a lot of troubleshooting and a revision which opens up a lot of potential for more flexible customization of the anchor <a> tag that’s used for the link. If anyone has interest in getting more use out of that, let me know. For example, we could have the option of applying the style classname to the <a> tag rather than the span that wraps the <a> tag. I think this was a request a while back, but now it’s much easier to implement.

Last edited by philipashlock (2006-10-23 09:33:07)

Offline

#59 2006-10-26 21:15:35

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

Testing the version of the last post I noticed the following effect:

Plugin works semi-well with existing excerpts (I use it together with exosting excerpts for producing a “read-more”-link within the paragraph of the excerpt):
It deletes the last three characters of the excerpt (characters as well as spaces).

I use the following code:

<txp:beginning length="250" format="inside" linktext="weiterlesen" styleclass="cont" cfield="continue" />

Last edited by saccade (2006-10-26 21:16:38)

Offline

#60 2006-10-27 01:25:16

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: [plugin] [ORPHAN] Beginning (update and merge of pfa_beginning + ede_beginning)

Philip, could you pls. update the download link in the very first article of this thread?

A problem I am having with this plugin is that I am very often using one or more img tags at the beginning of articles. I would love to have an attribute ‘ignore_tags’ which would allow to ignore one or more HTML tags.

Any chance to get that function into the Beginning plugin?

To generate an excerpt even if there is already an excerpt I deleted and changed some parts of he code. Basically I exchanged the check for an excerpt with a simple check for an article body and deleted the whole if-excerpt condition/function.

New code (tested OK with 4.0.4):

// ----------------------------------------------------

	function beginning($atts)
	{

	  global $thisarticle;

	  extract(lAtts(array(
	    'styleclass'	=> 'pfab-morelink',
	    'length' 		=> 350,
	    'linktext' 		=> 'Read More',
	    'cfield' 		=> 'continue',
	    'format' 		=> 'outside'
	  ),$atts));


		//Check for custom field entry.
		if (trim($thisarticle[$cfield]) != '') {
		$linktext = $thisarticle[$cfield];
		}

		if ($styleclass !== '0') $styleclass = ' class="' . $styleclass . '"';
		else 					   $styleclass = '';


		if ($linktext) {
			if($format == 'inside' ){
			// Add closing </p> tag after link
			$link = "<span$styleclass>" . '<a href="'. permlinkurl($thisarticle) . '">' . $linktext . "</a></span></p>";
			}
			else {
			$link = " <span$styleclass>" . '<a href="'. permlinkurl($thisarticle) . '">' . $linktext . "</a></span>";
			}
		}

// CHANGE: Just check if body exists. Deleted the whole 'if excerpt' code

        if (trim($thisarticle["body"]) != '') {
				// We only bother to generate the excerpt if the article is longer than length
				if ($length < strlen($thisarticle['body'])) {
						$body = $thisarticle['body'];

						$i = 0;
						$p_end[$i] = strpos($body, '</p>') + 4;

						while ($p_end[$i] < $length) {
							$i++;
							$last = $i - 1;
							$more = substr($body, $p_end[$last]);
							$p_end[$i] = strpos($more, '</p>') + 4 + $p_end[$last];

						}

						$beginning = substr($body, 0, $p_end[$i]);
						/*
						It's still possible for us to generate an excerpt that is the entire article
						(because we give precedence to full paragraphs rather than length).

						If this hasn't occurred, then we glue on the link
						 */
						if (!((strlen($beginning)+3) >= strlen($body))) {
							if($format == 'inside' ){
							//Remove closing </p> tag from generated excerpts.
							$clipped = substr_replace($beginning,"",-4);
							$beginning = $clipped . $link;
							}
							else{
								$beginning = $beginning . $link;
							}
						}

				}

				// If the article is shorter than the length, then we show the whole thing - without a link
				else {
				$beginning = $thisarticle['body'];
				}
		}

		return $beginning;
	}

	// Credits:
    // This plugin was radically improved by Ed Everett (edeverett), thank him for:
    // 		1)Custom Field Input 2)inside/outside format for placement of the "full article" link

    // thanks to schmoboy for helping to improve the quality of this plugin
    // linktext and excerpt checking adapted from kgr_safe_excerpt by Kurt Raschke
    // permlink revision (for rc3) by Julian Stahnke www.julianstahnke.de
    // Also thanks to alexbrie for helping to keep this up to date

This works fine but still has the disadvantage that i.e. image tags at the beginning of the article body are shown. I need some code to ignore existing img tags as I want a pure text excerpt.

Last edited by merz1 (2006-10-27 01:29:23)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

Board footer

Powered by FluxBB