to previous topic Print topic to next topic

 Root :: Developments :: Blocks :: centerblock-hack needet - a block for the pn-book module
 Moderated by:
 
  Bottom  centerblock-hack needet - a block for the pn-book module
floobee Posted: 30.04.2004, 14:42
Noob
Noob


registered: Apr 30, 2004
Posts: 4

Status:  offline
last visit: 04.10.04
hello, good day

well perhaps this is the wrong place to ask but i saw the pretty nice modules and blocks of pnconcept. So i decided to ask a request on a block - a centerblock which would be very helpful.

i am running a book-module for postnuke. It is called the pn-book, and i got it from the site here http://pn-mod-books.sourceforge.net
just want to know if it is possible to run a centerblock with this module.
I want to show more books than only one. Is it possible to show let me say 5 to 6 books
in a centerblock of this module. Like you can see it on the page http://www.preciogasolina.com - with the NukeAmazon-module.

there are the following blocks bundled within the postnuke-module, pn-books. The following ones:

randombook
i-topratedbook
i-lastbooks
popularxbooks


do you think that this is possible ? That would be supergreat! How should i hack a block to get a centerblock that fits the same behaviour like the block on http://www.preciogasolina.com

thanks for any help in advance.

Your Floobee,


here a code of the block that could be used for the hack - if you could give some guidelines or have some ideas that would be very good. I want to show 4 to 6 books in the centerblock! - is that possible.

Again - thanks for any help in advance!!


Code
  1. <?php // $Id: randombook.php,v 1.1 2002/10/05 15:02:27 fredb86 Exp $
  2. // ----------------------------------------------------------------------
  3. // BOOKS module
  4. // Copyright (C) 2002 by Michael Schatz
  5. // Written by Michael Schatz and Jason Levitt and Olivier Guillet
  6. // Get the newest version at http://sourceforge.net/projects/pn-mod-books
  7. // ----------------------------------------------------------------------
  8. // POSTNUKE Content Management System
  9. // Copyright (C) 2002 by the PostNuke Development Team.
  10. // http://www.postnuke.com
  11. // ----------------------------------------------------------------------
  12.  
  13. $blocks_modules&#91;'randombook'] = array(
  14.     'func_display' => 'random_books_block',
  15.     'text_type' => 'randombook',
  16.     'text_type_long' => 'Random Book',
  17.     'text_content' => 'Books',
  18.     'support_nukecode' => false,
  19.     'allow_create' => false,
  20.     'allow_delete' => false,
  21.     'form_url' => false,
  22.     'form_content' => false,
  23.     'form_refresh' => false,
  24.     'show_preview' => true
  25. &#41;;
  26.  
  27.  
  28. // Security
  29. pnSecAddSchema&#40;'Booksblock::', 'Block title::');
  30.  
  31. function random_books_block&#40;$row) {
  32.  
  33.     if &#40;!pnSecAuthAction(0, 'Booksblock::', "$row[title]::", ACCESS_READ))
  34.     &#123;
  35.         return;
  36.     &#125;
  37.  
  38.     $bookprefix = pnConfigGetVar&#40;'prefix');
  39.  
  40.     $BooksModName = "books";
  41.    
  42.     //Retrieve these module variables which were set in
  43.     //pninit.php
  44.     $booksdir=pnModGetVar&#40;'books','booksdir');
  45.     $imagesdir=pnModGetVar&#40;'books','imagesdir');
  46.     $blockcover=pnModGetVar&#40;'books', 'emptyimage');
  47.  
  48.     $boxstuff = "<font class=\"pn-normal\"><center>";
  49.     $bkresult = mysql_query&#40;"select bkid, title, cover from $bookprefix"._books_books." ORDER BY rand() LIMIT 1");
  50.  
  51.     while&#40;list($bkid, $bktitle, $cover)=mysql_fetch_row($bkresult)) {
  52.         $bktitle = stripslashes&#40;$bktitle);
  53.         $transfertitle = ereg_replace &#40;" ", "_", $bktitle);
  54.  
  55. // If there is no cover image in the database, use the dummy cover
  56.     if &#40;$cover == "") {
  57.        $coverimg = $imagesdir.'/'.$blockcover;
  58.     &#125; else {                //Check for URL and fetch that
  59.        if &#40;stristr($cover, "http")) {
  60.           $coverimg = $cover;
  61.        &#125; else {         //Use the cover image in the books directory
  62.           $coverimg = $booksdir.'/'.$cover;
  63.        &#125;
  64.     &#125;
  65.  
  66.         $boxstuff .= "<a class=\"pn-menu\" href=\"modules.php?op=modload&amp;name=$BooksModName&amp;file=index&amp;bkid=$bkid&amp;ttitle=$transfertitle\"><img src=\"$coverimg\" border=\"0\" alt=\"\"></a><br>";
  67.         $boxstuff .= "<a class=\"pn-menu\" href=\"modules.php?op=modload&amp;name=$BooksModName&amp;file=index&amp;bkid=$bkid&amp;ttitle=$transfertitle\"><b>$bktitle</b></a><br>";
  68.     &#125;
  69.  
  70.     $boxstuff .= "</center></font>";
  71.     $row&#91;content] = $boxstuff;
  72.     themesideblock&#40;$row);
  73. &#125;
  74.  
  75. ?>
Top  floobee send PM
 
Chestnut Posted: 30.04.2004, 17:12
Site Admin
avatar

registered: Jun 02, 2002
Posts: 1320

Status:  offline
last visit: 07.02.08
Hi Floobee and thanks for the nice words.

Is this still a need ? I just stumble on this : http://www.portalzine.de/Forum-t2867.html

So I figure you found it before I wake up. :)


Chestnut ! Cool
Site Admin
Top  Chestnut send PM Homepage
 
floobee Posted: 30.04.2004, 17:57
Noob
Noob


registered: Apr 30, 2004
Posts: 4

Status:  offline
last visit: 04.10.04
hello Chestnut,

thanks for the reply.

ChestnutHi Floobee and thanks for the nice words.
Is this still a need ? I just stumble on this : http://www.portalzine.de/Forum-t2867.html So I figure you found it before I wake up. :)


thanks for the posting - it is still necessary. I am in need of such a center-block.

But i played around with the code and tried to figure out a solution.
i try to verify the hack-solution at the weekend - if it fails then i will come back to get some more infos.


in the meanwhile many thanks !!

floobee,
Top  floobee send PM
 



Powered by pnForum Version 2.0.1
DarkMindZ