Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Modules
Author Message
draxx
Involved
Involved



Joined: Nov 19, 2003
Posts: 282

PostPosted: Sun Mar 22, 2009 12:06 am Reply with quote

I know it exists but I can't seem to find that hack anywhere.

It gives you the ability to define which module a block will appear in or allow it to appear in all of them.

Anyone know of where I can find that hack?
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Mar 22, 2009 12:12 am Reply with quote

Can you give more details on this? I'm not connecting the dots Laughing. Thanks!
 
View user's profile Send private message
draxx







PostPosted: Sun Mar 22, 2009 12:57 am Reply with quote

Laughing Mabie that's why I can't find it in the searches. I'm doing a terrible job of naming it!

I don't know how else to describe it - it lets you choose which module a block will appear in... i.e. you can make a block that appears only in the your account module or only in the forums module or only in the weather module or whatever module you choose..... (left or right side blocks only- not center)

When you create the block you choose which module it displays in or you choose all for all modules.

It comes installed in nukeplatnium but Im sure it was a hack ....
 
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Sun Mar 22, 2009 1:00 am Reply with quote

Someone mentioned a theme add-on that had that feature, cant remember name for sure, "autotheme" maybe???
 
View user's profile Send private message Visit poster's website
draxx







PostPosted: Sun Mar 22, 2009 1:11 am Reply with quote

Nope this wasent theme related.

This is integrated in the blocks admin menu right under the "visible in which modules" is a "where is this block displayed" with a module list dropdown box and an all option at the top.
 
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Sun Mar 22, 2009 3:28 am Reply with quote

How about this: [ Only registered users can see links on this board! Get registered or login! ]
 
View user's profile Send private message
jakec







PostPosted: Sun Mar 22, 2009 3:28 am Reply with quote

BTW I believe Autotheme does have this ability as well.
 
horrorcode
Involved
Involved



Joined: Jan 17, 2009
Posts: 272
Location: Missouri

PostPosted: Sun Mar 22, 2009 1:13 pm Reply with quote

Are you thinking of the blocks manager?

WbBlocks Manager

Havent tried with RN but I think theres other posts talking about this.
 
View user's profile Send private message
jakec







PostPosted: Sun Mar 22, 2009 1:15 pm Reply with quote

There you go three options to choose from. Wink
 
draxx







PostPosted: Sun Mar 22, 2009 1:43 pm Reply with quote

Thanks guys! I will venture off and check these things out and report back Wink
 
draxx







PostPosted: Mon Mar 23, 2009 11:50 am Reply with quote

Okay Ravens option was fine - it would work - I dident test it. Too much work as you would have to define all your blocks in the theme and that would take forever if you got extensive.

Autotheme - I dident check it either.... as I rather assumed it was a theme that was built on Raven's theme suggestion. Again a bunch more work and the idea of dealing with a new "theme" did not please me.

So I went and downloaded that file from clanthemes ... after figuring out how to get some points Rolling Eyes .... and that worked - after a few adjustments and stealing a line of code from an old mainfile.php.

Basically the mod gives you a new blocks manager from the admin. It seems to work well and gives you a block page for each module. It lets you mass select the already made blocks to each mod ... so not too tedious.

Here is the last problem and I can't solve it - I need someone from here to solve it Smile - its using old code:

For simplicity here is the blocks function:

Code:


function blocks($side) {
//  global $storynum, $prefix, $multilingual, $currentlang, $db, $admin, $user;
//  changed and added for Blocks by module

    global $storynum, $prefix, $multilingual, $currentlang, $db, $admin, $user, $name;
    if ($multilingual == 1) {
        $querylang = 'AND (blanguage=\''.$currentlang.'\' OR blanguage=\'\')';
    } else {
        $querylang = '';
    }
    if (strtolower($side[0]) == 'l') {
        $pos = 'l';
    } elseif (strtolower($side[0]) == 'r') {
        $pos = 'r';
    }  elseif (strtolower($side[0]) == 'c') {
        $pos = 'c';
    } elseif  (strtolower($side[0]) == 'd') {
        $pos = 'd';
    }
    $side = $pos;

//  $result = $db->sql_query('SELECT * FROM '.$prefix.'_blocks WHERE bposition=\''.$pos.'\' AND active=1 '.$querylang.' ORDER BY weight ASC');

if (isset($name)) {
  $sql = "SELECT b.bid, b.bkey, b.title, b.content, b.url, b.blockfile, b.view, b.expire, b.action, b.subscription FROM ".$prefix."_blocks b, ".$prefix."_blocks_manager m WHERE b.bid=m.bid AND m.title='$name' AND m.bposition='$pos' AND b.active='1' $querylang ORDER BY m.weight ASC";
} else {
// $result = $db->sql_query('SELECT * FROM '.$prefix.'_blocks WHERE bposition=\''.$pos.'\' AND active=1 '.$querylang.' ORDER BY weight ASC');
   $sql = "SELECT b.bid, b.bkey, b.title, b.content, b.url, b.blockfile, b.view, b.expire, b.action, b.subscription FROM ".$prefix."_blocks b WHERE b.bposition='$pos' AND b.active='1' $querylang ORDER BY b.weight ASC";
}
$result = $db->sql_query($sql);

    while($row = $db->sql_fetchrow($result)) {
        $groups = $row['groups'];
        $bid = intval($row['bid']);
        $title = stripslashes(check_html($row['title'], 'nohtml'));
        $content = stripslashes($row['content']);
        $url = stripslashes($row['url']);
        $blockfile = $row['blockfile'];
        $view = intval($row['view']);
        $expire = intval($row['expire']);
        $action = $row['action'];
        $action = substr("$action", 0,1);
        $now = time();
        $sub = intval($row['subscription']);
        if ($sub == 0 OR ($sub == 1 AND !paid())) {
            if ($expire != 0 AND $expire <= $now) {
                if ($action == 'd') {
                    $db->sql_query('UPDATE '.$prefix.'_blocks SET active=0, expire=\'0\' WHERE bid=\''.$bid.'\'');
                    return;
                } elseif ($action == 'r') {
                    $db->sql_query('DELETE FROM '.$prefix.'_blocks WHERE bid=\''.$bid.'\'');
                    return;
                }
            }
            if ($row['bkey'] == 'admin') {
                    adminblock();
            } elseif ($row['bkey'] == 'userbox') {
                    userblock();
            } elseif (empty($row['bkey'])) {
                if ($view == 0) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                } elseif ($view == 1 AND is_user($user) || is_admin($admin)) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                } elseif ($view == 2 AND is_admin($admin)) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                } elseif ($view == 3 AND !is_user($user) || is_admin($admin)) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                } elseif ($view > 3 AND in_groups($groups)) {
                    render_blocks($side, $blockfile, $title, $content, $bid, $url);
                }
            }
        }
    }
}


So basically it had me change 1 line of code and add a variable. The variable is $ name and is declared in global with everything else. No problem.

The line was:

// $result = $db->sql_query('SELECT * FROM '.$prefix.'_blocks WHERE bposition=\''.$pos.'\' AND active=1 '.$querylang.' ORDER BY weight ASC');

and needed changed to:

if (isset($name)) {
$sql = "SELECT b.bid, b.bkey, b.title, b.content, b.url, b.blockfile, b.view, b.expire, b.action, b.subscription FROM ".$prefix."_blocks b, ".$prefix."_blocks_manager m WHERE b.bid=m.bid AND m.title='$name' AND m.bposition='$pos' AND b.active='1' $querylang ORDER BY m.weight ASC";
} else {
// $result = $db->sql_query('SELECT * FROM '.$prefix.'_blocks WHERE bposition=\''.$pos.'\' AND active=1 '.$querylang.' ORDER BY weight ASC');
$sql = "SELECT b.bid, b.bkey, b.title, b.content, b.url, b.blockfile, b.view, b.expire, b.action, b.subscription FROM ".$prefix."_blocks b WHERE b.bposition='$pos' AND b.active='1' $querylang ORDER BY b.weight ASC";
}


And then I had to add the line from an old mainfile after comparing why I was not getting ANY blocks.

$result = $db->sql_query($sql);

My question to the team is his changed lines. What would be the new proper way to call for that data. ? Can someone please translate them?

I also make the motion that this feature be added to the CORE. IMHO The dynamics of blocks by module means the kind of dynamic content that can be offered on a "real website" - and not just the same left and right blocks on all of the pages.

Thank you all for your suggestions and special thanks to Horrorcode for leading me to that mod ... I searched for 2 days before asking here.


Last edited by draxx on Mon Mar 23, 2009 5:54 pm; edited 1 time in total 
spasticdonkey







PostPosted: Mon Mar 23, 2009 5:37 pm Reply with quote

Yes, I too like the idea of adding the ability to display blocks by module. Smile

I noticed when tooling around with google sitemaps, that most pages that displayed both left and right blocks were deemed to be "to similar to each other". That might be different in some of the newer css based themes that load the center content first (ravenice? if I'm not mistaken?) ....

Still would be nice to be able to customize block content to be more relevant to the current module being viewed...
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©