Great!
its something similar to widget system on wordpress right?


![]() |
| | Thread Tools |
Admin Snippets | |||||||||||
|
Developed by Yankidank Developer Last Online: Feb 2012
This module comes default with Pligg 1.0. Subscribe to this thread by marking it as installed to receive notifications whenever it is updated. This module will make life a lot easier for people who want an easy way to add content to their templates but don't want to worry about upgrading their templates down the road. It's called Snippets, and this module is designed as a way for Pligg site admins to insert blocks of code (snippets) into one of the many "module hooks" that exist in the new Pligg 1.0 templates. It's kind of difficult to explain, so I will accompany this post with a few images and a video guide to show off Snippets. A perfect example of using this module would be to create a Google Analytics snippet. Inside this code block of this snippet you would insert your google analytics tracking code and set it to appear just before the </body> tag. The proper module hook for that would be "tpl_pligg_body_end". In only a couple seconds, without having to make any uploads or template edits you can have that code inserted into your site. This same idea could be applied to anything, whether it be sidebar advertisements or a welcome message placed on top of your homepage. It can all be added in quickly using Snippets. Best of all when you need to upgrade your template you won't have to keep track of all of these edits because you didn't need to edit the template files. Check out the video walkthrough here: Snippet Module | Screencast-O-Matic. -------------------------------------------------------------------------------------------- Update: November 10, 2010 This module now supports an import/export feature to allow you to save and share your settings. Download Now
Screenshots License Agreement The Affero GPL can be read by following this URL.Show Your Support
|
Similar Downloads | ||||
| Download | Developer | Category | Replies | Last Post |
| MooTools Login and Search Module | Yankidank | Free Modules | 15 | 11:05 AM 02-19-2011 |
| Site Stats - External Website Statistics | Yankidank | Free Modules | 16 | 08:14 PM 06-11-2011 |
| Featured News Module | Yankidank | Free Modules | 96 | 04:39 AM 10-14-2011 |
| FAQ Module | envmar | Free Modules | 30 | 03:29 PM 05-18-2011 |
| Social bookmark module update | urbn | Free Modules | 3 | 10:17 PM 01-03-2011 |
| Comments |
| |||
|
Great! its something similar to widget system on wordpress right? Watch Tv Episode Online - Watch your favorites Tv Shows. Last edited by onlinebisnes; 12-14-2008 at 11:41 PM. |
| ||||
|
I've never tried wordpress' text widget, but I assume that this module would be more powerfull since you can insert php, javascript and smarty code anywhere into your templates. There are something like 80 locations to choose from, if you use those locations in combination with some smarty code you can do some really specific template hacks.
The Twitter Module for Pligg CMS! Register, Login, and Submit Stories with Twitter. An absolute MUST HAVE for all Pligg sites! |
| |||
|
such a great idea... and it makes half the modules obsolete. howere, i get the dreaded error: "Fatal error: TPL: [in line 5]: syntax error: var function does not exist (class.compiler.php, line 485) in ..." when i try to add Google Analytics tracking javascript. Everything works fine if I just add text. So, I guess I need to figure out a way to escape the javascript so it reads the javascript code correctly? The javascript I'm trying to add looks like: <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-1234566-7"); pageTracker._trackPageview(); } catch(err) {}</script> |
| |||
|
nevermind... i figured it out... you just have to put any javascript inside a {literal} .... {/literal} smarty tag so it gets parsed correctly. now i can add google analytics javascript and google adsense javascript anywhere i'd like! hope this helps somebody... jeff |
| |||
|
I think this is very powerful and impressive, this framework could probably become the foundation for a lot of neat features. Google Analytics was already mentioned, but actually this could be used for things like Google AdSense as well, managing ads in general could be done in a very elegant fashion this way. I think what this might need to really "take off" would be a way for storing custom "snippets", i.e. to some form of XML file. That would make it possible for someone to create a snippet configuration for "Google Analytics" in a wizard like fashion: - text field name="Google Analytics" - text field desc ="Adds google analytics to your website" - text blob (JavaScript code) - required input: tracking code This whay, people could store their custom snippets as XML files and share them with others. Admins would then merely have to go to the "snippets" module, select "load wizard from XML file" - and go through the wizard to set up adsense/analytics etc for their website. The most complicated thing here would be doing some form of text substition so that certain elements of a template can be substituted - but this sort of stuff is supported by Smarty out of the box, so I would suggest to simply use Smarty for parameterizing and customizing blobs of code. Many of the things that are currently implemented as "modules" (like e.g. the AddThis module) could then be based on this snippets module instead and become completely self-contained XML files that could in theory even be downloaded and run via the admin panel. Last edited by woncount; 10-23-2010 at 03:37 AM. |
| ||||
| Quote:
The Twitter Module for Pligg CMS! Register, Login, and Submit Stories with Twitter. An absolute MUST HAVE for all Pligg sites! |
| |||
|
At some point, one might probably need to add a small key/value table to the database, so that such snippets can still feature settings that are configurable on demand by the admin, i.e. without having to re-run the whole wizard. Snippets could then add their own configuration keys to the corresponding table, so that a dedicated admin page would allow editing these accordingly. In its most basic form one could use a table structure like: id, description, key, value id----description-------key---------------------value ================================================== 00---"adsense ID"------ "adsense.pub_id" ----------- "pub-809801231" 01---"adsense slot"----- "adsense.slot_id" -------- "9898911" 02 ---"analytics id"------- "analytics.id"----------- "1121222" For the admin panel, a script would then dump out all rows in the table and make each setting configurable by using the description and the key as the label, and showing an input field for setting the value. In turn, snippets could look for their own "keys" in the corresponding table and read out the value. Keys should then by convention follow a self-explanatory format, i.e. by prepending their purpose: google_adsense.pup_id google_adsense_slot_id aoogle_analytics_id that would be pretty intuitive to work with and still very flexible and scalable |
| ||||
|
Updated the module. If you are upgrading, please uninstall then re-install it for the latest database modifications to take effect. The module now allows you to import and export settings. This allows you to share your snippets with others by uploading your XML files to the forums. I've attached an example to this post. The date_time.xml file will insert the current date and time to the top of your website. The Twitter Module for Pligg CMS! Register, Login, and Submit Stories with Twitter. An absolute MUST HAVE for all Pligg sites! |
![]() |
| Tags |
| module |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Admin Panel for 1.0 and above | mismeflight | Wiki Articles | 0 | 03-04-2009 11:04 AM |
| Why can't an Admin Account get to Administration? | slobizman | Questions and Comments | 1 | 12-29-2007 02:14 PM |
| [Fixed] Admin security bug | kevin1 | Questions and Comments | 4 | 03-05-2007 11:18 AM |