We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Displaying Recent Wiki Articles & Summaries (Plugin?)

Development and Programming

vosSavant's avatar
vosSavant
380 posts
16 years ago
vosSavant's avatar vosSavant

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!

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

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.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

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

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

Hey, Mark.

The docs for the plugin say:

<a href="http://{site_url}index.php/wiki/{page_name}/edit">Edit Page</a>

But there should be a / before the index.php. 😊

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

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

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

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.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

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

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

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

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
16 years ago
Robin Sowell's avatar Robin Sowell

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.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
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

       
vosSavant's avatar
vosSavant
380 posts
16 years ago
vosSavant's avatar vosSavant

Mark and Sue,

You guys are amazing…

This plugin is exactly what I needed. I must tell you - signing in and seeing that my question turned into an all-out plugin blew me away. I am very impressed with your response time and depth of service. Thank you!

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Hiya,

No problem at all. Let me know if there’s anything else you need adding to the plugin and I will see what I can come up with.

Hope it all goes well for you.

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Just as a quick update I have now created a new plugin thread specifically for this plugin which can be found here :

NEW Plugin - Wikee Display…

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

       
vosSavant's avatar
vosSavant
380 posts
16 years ago
vosSavant's avatar vosSavant

Mark - the plugin worked perfectly. Thanks for working on this. I hope it comes in handy for some other folks out there.

sincerely, vossavant

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

New parameter now added - randomize=”yes”.

Plugin thread over here.

Best wishes,

Mark

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.