How to add 'read more' link in article using simple CMS with WYSIWYG editor

I am adding some CMS functionality to a client site that I developed several years ago. The vast majority of the site is static however there are quite a few pages.

Anyway the client has asked to add a few new sections that need to include articles that the client will add to the site. The articles will include both text and images.

One of the requirements is that the article page displays several articles at once, with only some of each article displayed with a ‘read more’ link to navigate to read the full article. The article content that is displayed is not any fixed number of paragraphs or number of words but is arbitrarily decided by the client.

I therefore need a means of having an admin page to add an article that allows me to specify where the ‘read more’ link goes.

I was thinking of using the TinyMCE editor but not sure how I would add this “read more” link.

Any advice appreciated!

Thanks

Paul

p.s I am not interested in using a CMS like Joomla for this as this would involve recreating the entire site in Joomla - which I would imagine would take ages including the learning curve.

Hey no worries. I am going to try and go with the solution that has a field to specify how many paragraphs are before the read more link. Just need to get a solution to parsing the paragraphs. I have started a new thread to deal with this.

Sorry, no idea. I think of these things, but have never tried them. Think, Stephen Hawking. Ha! :smiley:

Thanks Anthony. I am not sure if I can have this such a button at the same time as using the TinyMCE editor (or similar editor) - can I? Sorry I haven’t used a WYSIWYG editor before so this is all new to me:)

Thanks Stephen

If I was to use a tag like wordpress uses, would it be the case of me having to give instructions to the client that they need to type <!–more–> into the text area field at the point they want the article to be split? Or is there a more user friendly way to do this for those that have no knowledge of “tags”

Thanks

Paul

Could you not have a nice little ‘Insert Read More’ JavaScript button to add this (tag) for you?

WordPress uses the <!–more–> tag to indicate where the “read more” message should go.

Thanks for the replies.

The client has supplied the copy for these articles already and it is a case of splitting the articles at the end of specific paragraphs rather than after a fixed number of characters.

Hadn’t considered wordpress and to be honest haven’t used it before either so could be a steep learning curve to implement this into my existing site structure?

I just had a thought that I could just use a bog standard text area field in the admin area and have a form field to specify the number of paragraphs to show before the “Read more” link.

Though this would require the ability to extract X number of paragraphs from the text in the database. Any advice on how to do this appreciated.

Possibly something like the following would work?



$paragraphs = explode("\
\\r", $_POST['article']);


See any flaws in this?

Just give them a text box, decorate it with a wysiwyg editor if you want, then just chop off the first x characters and use that as the “intro”.

I tend to create a separate “intro” text area, max say 120 chars - and spell out to them on the GUI that this is very important, must work as a teaser etc etc.

Focusses the editors on thinking harder on what the importance of the intro instead of just blathering on.

Could you not just use a tag like {read_more}. Then when displaying several articles, only show the content before the tag. When viewing the full article, take out the tag and show everything?

This might be a good role for WordPress to play. It is a blog/article CMS that works nicely as a section of a website if you want it to. It’s easy to install and set up.

There are other CMSs out there that are small and well suited to integrating into an existing site. Perch is a lovely example of such an one.