Topic: Sticky
How do I generate sticky posts? Like for example a post which is always shown at the top of my category?
You are not logged in. Please login or register.
ochiba forum → Support → Sticky
Pages 1
How do I generate sticky posts? Like for example a post which is always shown at the top of my category?
I'm afraid there isn't a "sticky" feature currently in ochiba, but it's on my to-do list for ochiba v2.
One way you can perhaps hack this in is to use the "description" field for your category - of course, this doesn't give you the same look/feel/flexibility of a regular post, but if it's just an announcement you'd like to put at the top, this might work for you.
hmmmm... is there any specific markup language that I can use in the description? like to break lines, change font size, weight, colour?
Just a warning: this is a bit uglier than I'd like:
Out of the box, ochiba will escape (htmlspecialchars) the description of a category, but if you "disable" that, you can use any HTML you desire. Since most likely it will be just you editing this, it should be safe from attack as long as you know what you're doing (ie basic HTML).
To disable the escaping, you would make the following change to includes/images.php:
--- includes/images.php 3 Feb 2006 02:37:38 -0000 1.48
+++ includes/images.php 14 Jul 2009 01:39:23 -0000
@@ -361,7 +361,7 @@
if($category == "Stats") {
$vars["category"] = "Top " . LIMIT . " Most Viewed Images";
}
-$vars["description"] = $category == "Stats" ? "" : htmlspecialchars(stripslashes($categories[0]["description"]));
+$vars["description"] = $category == "Stats" ? "" : stripslashes($categories[0]["description"]);
if (!is_numeric($category) && count($images)>=1) {
$vars["pager_top"] = $pager;
$vars["pager_bottom"] = $pager;
In other words, on line 364, remove the htmlspecialchars() call.
The other place the description appears is as a tooltip (title attribute) in the menu of categories. Since you are using these descriptions for more than just "my cat pics", you should probably just disable those. In includes/functions.php:
--- includes/functions.php 30 Aug 2005 08:06:08 -0000 1.42
+++ includes/functions.php 14 Jul 2009 01:41:41 -0000
@@ -99,10 +99,9 @@
$result = $db->query($sql);
$menu = "";
while($row = $result->fetchRow()) {
- $menu .= sprintf('<a href="%s/%s" title="%s">%s</a>%s',
+ $menu .= sprintf('<a href="%s/%s">%s</a>%s',
ROOT,
$row["abbr"],
- $row["description"],
$row["category"],
"\n");
}
In other words, remove the references that display the description.
After those two changes, you should be able to edit the description using HTML. Hope this helps.
Pages 1
ochiba forum → Support → Sticky
Powered by PunBB, supported by Informer Technologies, Inc.
Generated in 0.017 seconds (73% PHP - 27% DB) with 9 queries