Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Poll
Do you think this is a good point for implementing into future versions
yes
50%
 50%  [ 1 ]
no
50%
 50%  [ 1 ]
it depands, i tell you why in the post below
0%
 0%  [ 0 ]
Total Votes : 2


Author Message
wHiTeHaT
Life Cycles Becoming CPU Cycles


Joined: Jul 18, 2004
Posts: 577
Location: Netherlands

PostPosted: Mon Aug 10, 2009 5:01 am Reply with quote

Wasnt it before , that when a block didnt had any content , it wouldnt even show up?

i remember something like that for older nuke versions , however it could be that i just imagine this.

[continued post]

A few minutes after posting above message.
i realised that i had a point.
I asked myself "why a user must be confrontated with a bogus block?".
So i thought: lets show the reporting for the admin only . no?

Here is what i did (not so special at all):
replace function blockfileinc
with:
Code:



function blockfileinc($title, $blockfile, $side=0) {
  global $admin;
    $blockfiletitle = $title;
    $file = file_exists('blocks/'.$blockfile);
    if (!$file && is_admin($admin)) {
        $content = _BLOCKPROBLEM;
   
    }
    if (!$file && !is_admin($admin)) {
        $content = '';
   
    } else {
       if( file_exists('blocks/'.$blockfile)) {
        include_once('blocks/'.$blockfile);
      }
    }
    if (empty($content) && is_admin($admin)) {
        $content = _BLOCKPROBLEM2;
    } else { //Added by montego from http://montegoscripts.com for TegoNuke(tm) ShortLinks
        global $tnsl_bAutoTapBlocks;
        if (defined('TNSL_USE_SHORTLINKS') && isset($tnsl_bAutoTapBlocks) && $tnsl_bAutoTapBlocks) {
            $content = tnsl_fShortenBlockURLs($blockfile, $content);
        }
    }
    //End of TegoNuke(tm) ShortLinks
if (empty($content)) {
   $content = '';
}else{
    if ($side == 1) {
        themecenterbox($blockfiletitle, $content);
    } elseif ($side == 2) {
        themecenterbox($blockfiletitle, $content);
        } else {
        themesidebox($blockfiletitle, $content);
    }
}
}


and function render_blocks
with
Code:



function render_blocks($side, $blockfile, $title, $content, $bid, $url) {
  global $admin;
    if(!defined('BLOCK_FILE')) {
        define('BLOCK_FILE', true);
    }
    if (empty($url)) {
        if (empty($blockfile)) {
         
         if (empty($content) && is_admin($admin)) {
        $content = _BLOCKPROBLEM2;
       
        } if (empty($content)) {
        $content = '';
            }else{
            // GT-NExtGEn 0.5 by Bill Murrin (Audioslaved) http://gt.audioslaved.com (c) 2004
            //Modified by montego from http://montegoscripts.com for TegoNuke(tm) ShortLinks
            global $tnsl_bAutoTapBlocks;
            if (defined('TNSL_USE_SHORTLINKS') && isset($tnsl_bAutoTapBlocks) && $tnsl_bAutoTapBlocks) {
                $content = tnsl_fShortenBlockURLs('', $content);
            }
            //End of GT-NExtGEn / ShortURLs
            if ($side == 'c') {
                themecenterbox($title, $content);
            } elseif ($side == 'd') {
                themecenterbox($title, $content);
            } else {
                themesidebox($title, $content);
            }
        }
       
        } else {
            if ($side == 'c') {
                blockfileinc($title, $blockfile, 1);
            } elseif ($side == 'd') {
                blockfileinc($title, $blockfile, 1);
            } else {
                blockfileinc($title, $blockfile);
            }
        }
    } else {
        if ($side == 'c' OR $side == 'd') {
            headlines($bid,1);
        } else {
            headlines($bid);
        }
    }
}

So what this do?
If you are a user and not logged as admin , you just dont see the block at all.
However , if your logged as admin , you see the default reporting as usual.
This optional change , came to life couse of the following post:

Only registered users can see links on this board! Get registered or login!

[EDIT] in ocasions i like to be heard , dev's of the php-nuke system and forks need to realise that this isnt just a simple solution to some issue's i came across.
I even wont say this solution is 100% thight , it for sure needs some revisiting.
I simply now it is a part of the key for further releases for any kind of nuke.
when you acomplish this in a secure way, it will open doors.
in the netherlands we say... look further then your nose length
 
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
wHiTeHaT
PostPosted: Mon Aug 10, 2009 4:34 pm Reply with quote

imagine the folowing:
you have a block enabled called: uploaded files (for the download section)
or a block called: provided web links ( for the Web_Link) section
or a block called Submited news ( for the news/submitted news section)
Above are just regular scenario's.

however as admin you dont want to be to concerned, but still give info or content to your user.

Now what this tweak do?

Lets say you created a block to inform users how much, even if , or to what he/she submitted a news to, even if needed per topic , that is something you decide in the block.
But in default nuke raven or any other, there's no way to show a block if it have something to tell you or not.
So this tweak do it for you and simplefy all.
So if you submited a news to topic X and show when + the link , it will show ( depanding on your blocks code)
If there's nothing to show, the block wouldnt even be active for the user. BASTA!! that is what i wanted to explain

another explenation:
imagine as admin you have a block enabled just to let you now your users(s) recieved a private message.When ever they recieved one , the block will show up , when they never got one, the block simply wont show.
Ofcouse i'm aware of the pop-up window for PM's , i just wanted to simplefuy the idea to you.
You could do this to every scenario that can occure.
 
wHiTeHaT
PostPosted: Mon Aug 10, 2009 4:56 pm Reply with quote

An admin ocasion:
whenever a block is active and doesnt have anything important to show to the admin.
A message will apear to him telling that theire isnt any content for him.
OR when there is a problem ( currently only the file exist and empty content check) , show a different message.
The reporting for now uses only:
defined: BLOCK_PROBLEM and BLOCK _PROBLEM2

What this tweak could use:
a direct admin reporting when ever there's really something wrong with the block.
When there's really something broken , for example the code itself , it should be reported to the admin only , for now if the block code self is broken , all user + admin see an error on the page.
an alternative would be to check before any content inside a block , if the content is a valid call to a content.
 
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Mon Aug 10, 2009 7:10 pm Reply with quote

I have a problem understanding what you are writing, mostly because the lack of capitalization and weird punctuation. I know you're probably not a native English writer, but improving the writing of your posts can really help us help you: we don't want to spend time trying to decipher what you are writing about.

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
wHiTeHaT
PostPosted: Mon Aug 10, 2009 11:37 pm Reply with quote

A simpel explain: block shopping cart has 0 items <--- no need to show block.
Block shopping cart has 1 or more items <--show the block.
 
wHiTeHaT
PostPosted: Mon Aug 10, 2009 11:39 pm Reply with quote

in default installation of any nuke block old messages say... there arent any old messages.

There's no reason to tell that, or show the block at all.simply not show it.
But once there are old messages , show the block.

Lucky price winner for the 1.000.000 visitor.
Let check a script do the counting.Once you going to be the 1.000.000 , the block will appear automaticly with a pre-setted message , for example:Congratulations evader , you won.

if $content = ''; dont show block
else show it.

php is also a language. Wink
 
xGSTQ
Involved
Involved


Joined: Feb 03, 2006
Posts: 267
Location: UK

PostPosted: Sat Oct 03, 2009 12:12 am Reply with quote

So you basicly want the option to show blocks to certain levels of authority

Anonymous (un registered users)
Registered Users
Groups (getting complex now!)
Admin's

There used to be a module that did just this, wasn't it Bob Marrion's? or it might have been Telli's cant remember its been a while now, but I get what your saying.

But you could also show blocks in certain modules only as well, the only feature that you mentioned that isnt available is the "hide a block until x"

Let me see if i can find it for you, but I don't think it would be compatible with RN 2.4
 
View user's profile Send private message Send e-mail Visit poster's website
wHiTeHaT
PostPosted: Sat Oct 03, 2009 2:42 am Reply with quote

you mean ws blockmanager.
I now this addon verry well.it is made to show blocks per module only.
The authority feature is already in nuke , also in ravens.

As you say "hide a block until X".
So X can be a user or a user action.But can be also a single page or pages.
The rule to follow is that you create your block with a closed $content.
you need to use the if { } methode.

But it is good you understand what it do , i also hope you see the potentials in it.
on the osc2nuke demo v3 you can see exactly what it do.
I also made a forum post on osc2nuke to explain the working of it.

Only registered users can see links on this board! Get registered or login!
 
wHiTeHaT
PostPosted: Mon Oct 11, 2010 3:39 pm Reply with quote

i want to raccle this post up.

It still seems people mis the advantage of this simple tweak.

A much more simple explenation maby then:

This tweak let you show up a block ONLY when it has $content in it what is at that moment or scenario in place.
For either single users,group users.

You can create a happy birthday block for example, and wish that particular person a happy birthday (only that user will see it).
In a normal situation the block would be alway's visible.
When use the tweak, it will only show to the user(s) who have his(their) birthday that day.

Guys use your imagination.
 
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6793
Location: Ha Noi, Viet Nam

PostPosted: Tue Oct 12, 2010 3:47 pm Reply with quote

I understand what you are saying but I'm not sure how this works.
In order to see if $content is assigned any data, you need to load the block file any way so I don't see how there is any benefit. If I had a block that didn't display any data, I would just the block off or modify the block. For example the block 'Big Story of the Day' doesn't always have data to show if you do not have new News posts every day, so it would make sense to just show the last news story rather than nothing.
 
View user's profile Send private message Send e-mail
wHiTeHaT
PostPosted: Tue Oct 12, 2010 4:17 pm Reply with quote

That is the exact point i try to make clear.
You wont see the block at all, so no block saying "big story of the day"... it just wont show up.
Until there is a story.
 
wHiTeHaT
PostPosted: Tue Oct 12, 2010 4:19 pm Reply with quote

if(!$content){
''; //not show the block @all
}else{
$content;
}

in a spicific osc2nuke module case....
if you have a shoppingcart block enabled... but have nothing added to your cart...why would show up the block telling you have nothing in your cart.
Instead of just not show the block at all until the user adds something to his cart.
 
Guardian2003
PostPosted: Tue Oct 12, 2010 4:56 pm Reply with quote

But the only way to see if $content is empty is to load the block file, which means it would be displayed.
You could use eval() to parse the file but it's far too dangerous.
 
wHiTeHaT
PostPosted: Wed Oct 13, 2010 10:49 am Reply with quote

No it NOT will be displayed.... that is what the whole tweak is doing.
But yes, ofcourse you must set the block active.
You do that couse you expect it someday or some moment for some person or some group, it will show up and present something.
 
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6383

PostPosted: Fri Oct 15, 2010 10:00 am Reply with quote

Sorry to jump in late on this, but I believe this might be handled by putting the logic to determine whether or not to display anything in the block itself, with modifications either to the theme and / or to mainfile to determine what to show if a block has no content.

See Only registered users can see links on this board! Get registered or login! for details. The RN development team has had some discussions about this, but haven't determined whether or not to proceed.

_________________
I google, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
wHiTeHaT
PostPosted: Fri Oct 15, 2010 11:25 am Reply with quote

yeah that is sort of a rip off of my idea.
 
kguske
PostPosted: Fri Oct 15, 2010 11:31 am Reply with quote

If you read it, you should understand how I came to that approach, and your request never figured into it as I only saw these comments today.

At any rate, credit is not relevant - the question is whether or not that addresses your request.
 
wHiTeHaT
PostPosted: Fri Oct 15, 2010 11:40 am Reply with quote

An approach withouth have to modify the theme seems better to me.
In case for the embedded block inside the news articles you must.
Or change the news module.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

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 ©