Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Forums / Cotonti / Extensions / Pages order in tag output

Macik
#39486 2014-04-28 18:41

Making plugins is just a piece of cake:

Look at here, check readme, download it and install — this is magic box for plugin creation.

Then let's create our simple plugin — look at this http://screenshot.galaxyhost.org/img/20140428-75f-72kb.jpg :

  1. Set (marked with green) plugin name, check setup file, addition files for our Hooks — `tagsort.first` and `tagsort.pages.query`. Marked wih blue is optional. Other are useless for out plug and should be unchecked.
  2. Add addition info in «Section 2» (http://screenshot.galaxyhost.org/img/20140428-5mp-48kb.jpg) — title, description, author name.

Press «Create extension files». Magic is done. Now we should work a little:

Locate files in `plugins/extension_template/created/tagsort`, copy it to plugins folder as usual plug. 

Open our generated files (`tagsort.first.php` and `tagsort.pages.query.php`), fix hook names and add corresponding code:
http://screenshot.galaxyhost.org/img/20140428-dob-66kb.jpg 
http://screenshot.galaxyhost.org/img/20140428-gs7-42kb.jpg

It's never been so easy. :)

Some code explanation (see post above):

  • For `tags.first` we extend drop down selection control with addition «sorting by» values as:  Begin date, author.
  • For `tags.search.pages.query` we alter part of tags search SQL query that sets pages order by our selected «sort by» value.

 

 

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F