whirlpool asked me to make him a custom block that displays a random image from the galleries.
I like my code because it uses taxonomy module functions instead of doing db queries.
< ?php
$albums = taxonomy_get_children(0, variable_get("image_nav_vocabulary", ""));
$foo = _image_album_properties($albums);
? >
<a href="/photos">
< img src="< ?php echo $foo[2]->thumb ? >" alt="random image"/>
</a>
<ul>
<li>gallery name: < ?php echo $foo[2]->name ? ></li>
<li>description: < ?php echo $foo[2]->description ? ></li>
<li>image count: < ?php echo $foo[2]->image_count ? ></li>
</ul>
Comments
Thanks
Thanks alot Alaa.
beware
the code doesn't check if the taxonomy and the image modules are loaded, it might break your site if they're not enabled.
and if you throttle any of these modules (you should) then you should also throttle the block or else it will break your site.
and by break I mean make it totally unaccessible
Alaa
"i`m feeling for the 2nd time like alice in wonderland reading el wafd"
Inaccessible drupal page
Is this why egyblogforum.manalaa.net is inaccessible? I don't think I've modified any of the settings related to the Random Image block.
Another thing, any idea how I can modify the Recent Comments block to display the Commenter's name, and maybe the original post title? Also, how to put the Article Categories in a separate block on the side bar?
Thanks.
no this is not why
very weird, egyblogforum opens fine here.
and no the random images block being used in egyblogforum is not my crufty custom code, it comes with the image module and is properly implemented with all the checks that would prevent a problem when throttle kicks in.
Alaa
"i`m feeling for the 2nd time like alice in wonderland reading el wafd"