Snipping when a custom word /tag is encountered?

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

Snipping when a custom word /tag is encountered?

Postby Esstee » Sun Jan 02, 2005 7:16 pm

I would like to make a custom button in my wysiwyg addon
that would say [snip] and I was wondering if we could make
a snip based on this custom tag or word instead of the usual
character number or paragraph?

anyone know how I would go about this?
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Re: Snipping when a custom word /tag is encountered?

Postby Parahead » Sun Jan 02, 2005 8:37 pm

Esstee wrote:I would like to make a custom button in my wysiwyg addon
that would say [snip] and I was wondering if we could make
a snip based on this custom tag or word instead of the usual
character number or paragraph?
Well, I don´t know how to make such a button in the wysiwyg addon, but I can tell you how to do it if just placing a [snip] in the Textarea. You use this at the top of your style:
Code: Select all
<PerlCode>
($SplitText, $TextLeftOver) = split(/\[split\]/, $Text, 2);
</PerlCode>

And then you can use <Field: SplitText> and <Field: TextLeftOver> in your style. I think you understand how to make both the split-style and the style with the full text use this technique?

On a slightly related topic, [url=http://coranto.org/forum/viewtopic.php?t=4810&highlight=bblongtext[/URL]this thread[/url] explains how to use another approach to achive a quote effect in a style...
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Actually

Postby Esstee » Mon Jan 03, 2005 1:39 am

:D

I'm not sure how to implement this.

I added:

Code: Select all
<PerlCode>
($SplitText, $TextLeftOver) = split(/\[split\]/, $Text, 2);
</PerlCode>


to the top of my default news style. I'm not using manginot etc.
I then added:

Code: Select all
<a href="http://your.site.com/cgi-bin/viewnews.cgi?id=>Field: newsid>">more...</a>


underneat "your.site" was ajusted. But I get no sniping effectm also
am is the snipping word "split"?
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Re: Actually

Postby bozoka45 » Mon Jan 03, 2005 7:19 am

Esstee wrote:
Code: Select all
<a href="http://your.site.com/cgi-bin/viewnews.cgi?id=>Field: newsid>">more...</a>


underneat "your.site" was ajusted. But I get no sniping effectm also
am is the snipping word "split"?


Well, first off, there is a tad bit of an error in your code. One of your arrows is pointing the wrong way. It should read:

Code: Select all
<a href="http://your.site.com/cgi-bin/viewnews.cgi?id=<Field: newsid>">more...</a>


I'm sorry, but I don't understand the rest of your post to help you enough.

If you're looking for a teaser effect, I'd suggest creating a CustomField and just copying and pasting however much of your Text you want into the CustomField_teaser box. It might make things easier to go from "blabhab read more.." to "full article."
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Re: Actually

Postby Parahead » Mon Jan 03, 2005 8:34 am

Esstee wrote:I'm not sure how to implement this.
First off, sorry to confuse you with using the word split instead of snip, I change this in the examples below, which is *two* styles, the first one should present the ingress of the newsitem (until the [snip] tag in you textarea) which basically is your Default Style and the other one presenting the full newstext. You can´t use the same style when passing the newsitem to viewnews.cgi, you must specify a full story style, see the example of how to pass that info to viewnews.cgi. I have also corrected your typo as bozoka45 pointed out...

The first ingress style (your Default Style) looks something like this:
Code: Select all
<PerlCode>
($SplitText, $TextLeftOver) = split(/\[snip\]/, $Text, 2);
</PerlCode>

<Field: Subject><BR>
<P><Field: SplitText><BR>
<a href="http://your.site.com/cgi-bin/viewnews.cgi?id=<Field: newsid>&style=fullstory">Read more...</a><br>
Posted by <Field: User> at <Field: Date>


The "fullstory" style used in the link to viewnews.cgi above should look very similar to the one above:
Code: Select all
<PerlCode>
($SplitText, $TextLeftOver) = split(/\[snip\]/, $Text, 2);
</PerlCode>

<Field: Subject><BR>
<P><Field: SplitText><Field: TextLeftOver><br>
Posted by <Field: User> at <Field: Date>
The reason for using SplitText and TextLeftOver in the second style is to remove the actual [snip] tag from the output. This can be done in other ways as well, but this works...

I also agree with bozoka45 that another way to solve this is to use two textfields, the normal textarea plus a ingress textarea. That way you have full control of producing an ingress that doesn´t need to be the exact same start as of the full text. This also allows you to use an if-statement in your ingress style to check if the ingress exists or not (and use the full story if not) and only show a "read more"-link then. I use this technique on one of my own sites... Example of ingress style:
Code: Select all
<If: Field: Customfield_Ingress>
 <Field: Customfield_Ingress><br>
 <A HREF="http://your.site.com/cgi-bin/coranto/viewnews.cgi?id=<Field: newsid>&style=fullstory">Read More...</A>
<Else>
 <Field: Text>
</If>
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby SrNupsen » Mon Jan 03, 2005 5:43 pm

Moved to correct forum.

SrNupsen
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

The second field idea is a great one...

Postby Esstee » Mon Jan 03, 2005 8:25 pm

I would love to use a second field but the problem is, our current flock of
news submitters are used to Article Manager and it offered WYSIWYG
article creation in all fields, I installed the WYSIWYG add-on in Coranto
but I was disappointed to find that we would loose othe WYSIWYG function
in any additional fields other than the default TEXT one.

With this in mind I opted to use a snipping feature in our main news entry
field. This isn't so bad because we can layout the entire news story and
place a tag to snip the teaser at the desired level and with this approach
I didn’t see any limitation.

I installed Maginot to try and accomplish this but for some reason it's less
than clear on accomplishing things given the documentation.

My current problem I'm facing with Coranto's static news system is we
have several news sections all which are heavily used, some 30 news
posts per day, others less and with our large userbase I am concerned
that the traffic load on our server would hinder our sites performance.

I may be wrong though if that is the case please don't hesitate to correct
me on that and I would gladly follow through using Coranto's viewnews.cgi
feature to split my pages.

Additionally, I have decided to take this project to a more visual level
so that things are clearer for anyone trying to help, text threads in a
forum tend to lengthen a troubleshooting process considerably by forcing
use to type and envision things on our own side of things often skewed
from the originators intent.

The new topic can be found here:
http://coranto.org/forum/viewtopic.php?t=7658

As soon as I get the OK to post my info. in this thread I will put together
a complete spread of my site design and projected news in a system
step by step image process.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project


Return to Customization

Who is online

Users browsing this forum: No registered users and 2 guests

cron