Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [archived] kgr_safe_excerpt
Trying out this plugin, but unsuccesful. My form looks like below, however I end up with all my article titles but no bodies.
<code>
<div id=“article”>
<h3><txp:permlink><strong><txp:title /></strong></txp:permlink>
·
<txp:posted /></h3>
<txp:if_individual_article>
<div class=“txt”><txp:body /></div>
</txp:if_individual_article>
<txp:if_article_list>
<txp:kgr_safe_excerpt words=“100” linktext=“Read more…” />
<br/>
<p style=“text-align: center”><img src=”/images/45.jpg”/></p>
</txp:if_article_list>
</div>
</code>
Offline
Re: [archived] kgr_safe_excerpt
sorry if this is completely off base.. but did you check that the plugin is turned on (to Yes) in the admin/plugins tab?
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
Re: [archived] kgr_safe_excerpt
Doh! It has been many months since I installed a new plugin, that was the problem. Thanks!
Offline
Re: [archived] kgr_safe_excerpt
:)
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
#41 2005-06-12 15:56:27
- Coin
- New Member
- Registered: 2005-06-01
- Posts: 2
Re: [archived] kgr_safe_excerpt
Just wondering, is there anyway of it being modified so that it showed the number of words, but only to the nearest “.” ? So, say I have words=“55” and after word #49 there is a “.”, it would cut out words #50-55? So that it doesn’t cut in the middle of a sentence?
I guess placing “…” in the plugin after the post will suffice for the moment, but a thought nevertheless (I’m a bit useless at PHP honestly…)
Offline
Re: [archived] kgr_safe_excerpt
I have installed this plugin, but it does not seem to be working properly. I am new to TXP so I could be that I haven’t set something right.
I have a section on the site I am working on that is set up as a blog. I have created a template for that section called blog and in the code I am calling the form that I created in < txp: article form=“blog” />. My form is called blog and it looks like this:
<pre>
<h3><txp:permlink><txp:title /></txp:permlink> :: <txp:posted /></h3>
<txp:body />
<txp:kgr_safe_excerpt words=“150” linktext=“Read more…” />
<br /><br />
</pre>
But when I view the page (http://dev.matthewpaulturner.net/blog) I see the posting, looks like a repeat of the first paragraph & then the “Read more…” link. I just want to show the first 150 words of the article, but it doesn’t seem to be working. Any ideas?
Thanks,
-j
“On the run from Johnny Law… ain’t no trip to Cleveland.”
Offline
#43 2005-06-13 20:45:26
- vagari
- Plugin Author
- Registered: 2004-08-25
- Posts: 19
Re: [archived] kgr_safe_excerpt
Remove <code><txp:body /></code> from your form, you’re basically telling it to show it twice. This plugin replaces the <code><txp:body /></code> element in the form.
Last edited by vagari (2005-06-13 20:46:29)
Offline
Re: [archived] kgr_safe_excerpt
Awesome! Thanks vagari!
One more question. Is there a way to allow the /blog article to still show a posted image? The top article has an image and when I removed the <pre><txp: body /></pre> tag the image is no longer in the excerpt?
Thanks again for your help!
-j
“On the run from Johnny Law… ain’t no trip to Cleveland.”
Offline
Re: [archived] kgr_safe_excerpt
I just used the ‘excerpt’ field and called the image in there. That will work just fine for now. Thanks again for the help! Thanks to Kurt for the great plugin!
-j
“On the run from Johnny Law… ain’t no trip to Cleveland.”
Offline
Re: [archived] kgr_safe_excerpt
Hello KurtRaschke,
I have made a few changes to the code of your plugin! Have a look maybe you like them maybe not. It will now strip the paragraph tag from the excerpt and gets a new attribute styleclass wich wraps the link in a span-tag with the given class name!
Here it is:
function kgr_safe_excerpt($atts) {
if (is_array($atts)) extract($atts);
//added function to strip tag(s)
function strip_chars($string,$chars) {
$tags_to_strip = $chars;
Last edited by ifeelcool.com (2005-06-22 13:33:02)
Offline
Re: [archived] kgr_safe_excerpt
Hey Kurt,
Great job on the plugin. I have a quick question for you. Is there any way to get around the kgr_safe_excerpt hiding article images if your article reaches your defined word limit? My setup looks like this: <code><txp:kgr_safe_excerpt words=“100” linktext=“read more »” /></code>. If I have an image in that article and it’s word count is past 100 it does it’s job, but it also hides the image. Any way around that?
Also how would I add in an anchor class to the href the plugin creates?
Thanks for your help!
-j
ps: I’m running Textpattern · 4.0.2
“On the run from Johnny Law… ain’t no trip to Cleveland.”
Offline
Re: [archived] kgr_safe_excerpt
ifeelcool.com,
Can you repost your mod of the kgr_safe_excerpt plugin please using the < code > < /code > tags please? I have tried to implement your code, but I can’t get it to work because of issues copying it from the browser.
Thanks,
-j
“On the run from Johnny Law… ain’t no trip to Cleveland.”
Offline