doc:tips:widgets
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | doc:tips:widgets [2019/01/12 17:53] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Advanced techniques: Widgets ====== | ||
+ | ===== Sticky posts ===== | ||
+ | |||
+ | A very common question is if the " | ||
+ | |||
+ | As some of you may know (and if you still don't, get to the [[doc: | ||
+ | |||
+ | Usually if you want a static page called " | ||
+ | |||
+ | Theme designers should be aware that they can be sure about at least **two** bars, left and right, which can they access in their themes templates using the tag | ||
+ | |||
+ | <code smarty> | ||
+ | {widget pos=left} | ||
+ | {$subject} | ||
+ | {$content} | ||
+ | {/widget} | ||
+ | </ | ||
+ | |||
+ | However, you are not forced to use only these positions, but **you can define your own sections** in the widget config panel. | ||
+ | |||
+ | For instance, you can define a new section, called, say, " | ||
+ | |||
+ | <code php> | ||
+ | $fp_widgets = array ( | ||
+ | ' | ||
+ | ' | ||
+ | // here are then the other usual sections | ||
+ | </ | ||
+ | |||
+ | |||
+ | which you will be able to access through | ||
+ | |||
+ | '' | ||
+ | |||
+ | For instance, here I have created a static page called " | ||
+ | |||
+ | |||
+ | [img=images/ | ||
+ | |||
+ | the **widget panel** entry looks like follows | ||
+ | |||
+ | <code php> | ||
+ | $fp_widgets = array ( | ||
+ | ' | ||
+ | ' | ||
+ | // etc... | ||
+ | </ | ||
+ | |||
+ | **index.tpl** has been edited, adding after the div with id=" | ||
+ | |||
+ | <code smarty> | ||
+ | {widgets pos=sticky} | ||
+ | <div id=" | ||
+ | < | ||
+ | {$content} | ||
+ | </ | ||
+ | {/widgets} | ||
+ | </ | ||
+ | |||
+ | while in '' | ||
+ | |||
+ | <code css> | ||
+ | .sticky { | ||
+ | padding: 4em; | ||
+ | background-color: | ||
+ | border: solid thin lightgrey | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | This technique can be applied to the other widgets, so if you want for instance to show a list of the latest entries using the **lastentries** plugin (please disable it from the sidebar, this plugin is a little slow :P) just edit the **widget config** like this | ||
+ | |||
+ | <code php> | ||
+ | $fp_widgets = array ( | ||
+ | ' | ||
+ | ' | ||
+ | // etc... | ||
+ | </ | ||
+ | |||
+ | It will look then like this : | ||
+ | |||
+ | [img=images/ | ||
+ | |||
+ | Yeah, I know, that's awesome, cool and whatever :D |
doc/tips/widgets.txt · Last modified: 2019/01/12 17:53 by 127.0.0.1