This question may be related to a resolved thread.
Hi EE,
I had this very same question in the thread linked to above, but it got overlooked and I moved on to other things. I’m now revisiting this issue.
Sue helped me on how to show a list of the most recently edited wiki articles, but we did not address how to show an excerpt from these posts, along with a link to “read more” and a link to “edit.”
The look I am going for is this:
[Article Title] [Article excerpt] [link to Read More] or [link to Edit]
You can see the format by visiting this page and looking under the “Discussion” tab in the lower left. I want to reproduce this look for the wiki articles, which will appear in the lower right of the same page.
I am fine with using the Word Limit plug-in to show only the first X words of the wiki article.
Any help you can give is greatly appreciated - thanks in advance!
The excerpt is going to be the tricky part. It involves joining to another table, grabbing the newest version of that wiki entry, and getting just part of the content.
The read more or wiki link is already in the code I sent you, and you just append /edit to the title for editing the entry.
This would be better suited to be a plugin.
Okay I thought I would have a quick go at this one so hopefully this works correctly.
I do possibly need to add in some security checks in case the incorrect type of data is sent through to the plugin but as long as you are the only person with access to your templates and you enter the right data then that shouldn’t hopefully matter too much.
Usage :{exp:wikee_display entries="4" characters="20" wiki_short_name="default_wiki" template_group="wiki"} <h2>{page_name}</h2> {page_content} <a href="http://{page_name_link}">Edit Page</a> <hr > {/exp:wikee_display}
You will need to find out the short name of your WIKI to use in the wiki_short_name=”default_wiki” parameter.
Place the name of the template group and template (if a template other than index is being used) that is being used to hold your wiki code into the template_group=”wiki” parameter.
Hopefully this should work correctly. I only just got it working so I may have the wrong idea but hopefully not.
Oh and as a hidden extra I have also coded in the {switch="option_one|option_two|option_three"} variable too!! 😉
Best wishes,
Mark
Hmm not on my system 😉
I will look at using the create_url function instead so that it does this automatically and then create a variable for it. I think this is all dependant upon what you have in your {site_url} variable though so if you need it you can add it if not then don’t. I will look at adding in that function though to make it easier all round though.
Thanks Sue. By the way if you add in the slash does the plugin work okay for you and do what it should do?
Best wishes,
Mark
So far.
The only thing that is missing (and I know sorta how to make it work in the plugin I wrote to display entries from Freeform was to “borrow” from the pi.title.php file:
if ($query->num_rows > 0)
{
if ( ! class_exists('Typography'))
{
require PATH_CORE.'core.typography'.EXT;
}
$TYPE = new Typography;
$content = $TYPE->xhtml_typography($query->row['comments']);
}
else
{
$content = '';
}
$this->return_data = $content;
}
To use typography on the comments field in Freeform. Otherwise you have a bunch of non-formatted text.
Oops 😉
Knew I’d miss something out somewhere!!
I’ve updated the plugin to have new parameters now to deal with automatically creating the page edit link for you. New documentation is in the plugin and also in the post above too.
I will go back and add in the formatting for the contents field now. Thanks for the heads up on that Sue. I’d forget my head if it wasn’t screwed on!! 😊
Best wishes,
Mark
Okay plugin now updated to add in the Typography class.
I think there might be something a little funny in it now using that as on one of my entries I got the content text and then the ellipsis is placed on to the next line instead of after the content. Will take a look in the core.functions.php and see where the ellipsis is being added in. I will try and change that if it causes a problem for anyone but to do so I will probably have to write my own code for the character limiting part of the plugin instead of using the in-built char_limiter function unless I am doing something silly somewhere where by in which case please do someone tell me!! 😉
Anyway hope the plugin is useful?
Best wishes,
Mark
Hm- seems this has evolved into a full blown plugin, I’m going to shift to the ‘Plugin forum’ and tweak the title a wee bit so folks can find it a bit easier.
Okay, no problem. I’ve also just made a quick update to the plugin to deal with escaping the PHP variables in the SQL queries. Naughty me I’d neglected to do that too!!
Best wishes,
Mark
Just as a quick update I have now created a new plugin thread specifically for this plugin which can be found here :
I will place all updates (should any be needed) into the top post of that thread instead from now on just to keep everything together.
Hope the plugin worked out okay for you vosSavant?
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.