Page 2 of 2

Posted: Fri Nov 02, 2007 2:02 pm
by hgoor
Don Chambers wrote:Bulletproof 1.1 is never going to be in spartacus... bulletproof is one of s9y's core templates. There will be 2 ways to get bp updates. First, if s9y is updated (ie, 1.2.x or 1.3), the latest bp will be in that release. Second, we are maintaining a download location for interim bp releases so we do not have to wait for s9y to be updated when we want to update bp. BP updates, including 1.1, can be downloaded here:

http://s9y-bulletproof.com/index.php?se ... ]=download

BP does use a banner ID of serendipity_banner, but I have not tried this plugin Garvin mentions so I cannot be sure if it will work or not... but I suspect it will.
Ah, OK. I understand. So, coming back to my question: rotaing banners randomly should be build in to the BP template as there is no other option I guess that will work for sure....

Posted: Fri Nov 02, 2007 2:03 pm
by judebert
Knowing Don, probably. But the plugin, now named "Template Header/Logo Image" in SPARTACUS, supports three different header types, and is easy to configure and test. Just install it, specify the path to your image directory, save the configuration, and try your blog. If nothing happens, reconfigure for one of the other header types.

If you get it to work, come back and tell us so others will know what to do. If you can't get it to work, let us know so we can update it for BulletProof.

Posted: Fri Nov 02, 2007 2:26 pm
by Don Chambers
judebert wrote:Knowing Don, probably. But the plugin, now named "Template Header/Logo Image" in SPARTACUS, supports three different header types, and is easy to configure and test. Just install it, specify the path to your image directory, save the configuration, and try your blog. If nothing happens, reconfigure for one of the other header types.

If you get it to work, come back and tell us so others will know what to do. If you can't get it to work, let us know so we can update it for BulletProof.
Jude - you seem to be the resident expert on banners & the media library.... perhaps that plugin could be updated to offer an option to load images from a particular folder in the media library??? Not sure if that is pandora's box though... specifying the wrong folder, or the entire media library could have some fairly nasty results! :)

Posted: Fri Nov 02, 2007 2:42 pm
by judebert
Bingo! I figured that I'd better leave it restricted it so people could verify their banner images were the correct size and format.

You could set it to a media library directory; you'd just have to type the right path. Then you could manage the banner images with the media library controls. But I didn't want to add a media selector, because that would just lead to trouble.

Posted: Fri Nov 02, 2007 4:09 pm
by hgoor
judebert wrote:Bingo! I figured that I'd better leave it restricted it so people could verify their banner images were the correct size and format.

You could set it to a media library directory; you'd just have to type the right path. Then you could manage the banner images with the media library controls. But I didn't want to add a media selector, because that would just lead to trouble.
I have put all my headers in a Media Library directory as this is the way Bulletproof works: you can assign a header using the media library, so I figured I make a directory just for that....

btw: if anyone is interested I can share those headers for people to use... I think I have a few nice ones (if I say so myself)..

Posted: Fri Nov 02, 2007 4:56 pm
by Don Chambers
So did you install that plugin? Does it work with the images you uploaded?

Posted: Fri Nov 02, 2007 5:05 pm
by hgoor
Don Chambers wrote:So did you install that plugin? Does it work with the images you uploaded?
No haven't had the time yet will do so probably this Sunday...

Re: category-header: individual header image for each catego

Posted: Wed Jun 11, 2014 10:54 am
by Huhu
Hej!

I tried the plug-in, though with no success (here). The DIV has the appropriate ID.

Now I would just choose a workaround by implementing a

Code: Select all

<!--#include virtual="randompicture.php" -->
to a simple PHP code snippet that would do the job (or better insert the code snippet directly into the index.tpl). Problem is to get that PHP snippet to work with the parser ... any hints?

Example for the php script, just for the show (it works fine if interpreted)

Code: Select all

<?php
   // Randompic
 srand ((double) microtime() * 1000000);
 $random = rand(1,4);
 
  if($random=="1")
  {
  echo "<div id=\"header\" style=\"background: url(headers/h_1.jpg) ;
  	 \" />";
 }  etc.

Re: category-header: individual header image for each catego

Posted: Thu Jun 12, 2014 3:19 pm
by garvinhicking
Hi!

You can edit your index.tpl file of the template (ideally you should create your own template). Then, inside your template directory you can edit/create a config.inc.php file:

Code: Select all

<?php
function randomPicture() {
 srand ((double) microtime() * 1000000);
 $random = rand(1,4);
 
 echo "<div id=\"header\" style=\"background: url(headers/h_" . $random . ".jpg) . "\" />";
}

$serendipity['smarty']->register_function('randomPicture', 'randomPicture');
then in your index.tpl you could call:

Code: Select all

{randomPicture}
which would call said PHP function.

HTH,
Garvin

Re: category-header: individual header image for each catego

Posted: Thu Jun 12, 2014 9:45 pm
by Huhu
GREAT! And again a big step (for me) to customizing templates, now with understanding the logic behind smarty, finally ;)

Thanks a lot!

Re: category-header: individual header image for each catego

Posted: Fri Jun 13, 2014 9:29 am
by Timbalu
S9y does include workarounds for this old Smarty2 syntax to not break with older Plugins

Code: Select all

$serendipity['smarty']->register_function('randomPicture', 'randomPicture');
But for sure it is better to learn the new Smarty 3 syntax, since we don't know at when these helper compat functions will be removed, eg

Code: Select all

$smarty->registerPlugin("function",'randomPicture', 'fncRandomPicture'));
http://www.smarty.net/docs/en/api.regis ... dp16782656