Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm



Joined: Aug 13, 2009
Posts: 1122

PostPosted: Thu May 30, 2013 4:42 am Reply with quote

I created a Wimpy Player block and everything looks fine and working properly. I wonder if there is a better way to do it let me know please

Code:
<?php



if (!defined('BLOCK_FILE')) {Header('Location: ../index.php');  die();}
if (!defined('PHP_EOL')) define('PHP_EOL', strtoupper(substr(PHP_OS,0,3) == 'WIN') ? "\r\n" : "\n");

global $admin, $user;
$module_name = 'Media';

include_once 'modules/Media/go_config.php';

$content  = '<div class="text-center">' . PHP_EOL;
$content .= '<table style="width:100%" cellpadding="1" border="0"><tr><td>' . PHP_EOL;
if (is_admin($admin) OR (is_user($user))) {
$content .= '<a href="modules/' . $module_name . '/popup_wimpy.php" target="popup" onclick="wimpypopup()" title="Wimpy Player!"><img src="images/ipod.jpg" alt="" border="0" /></a><br />' . PHP_EOL;
    } else {
    }
$content .= '</td></tr></table>' . PHP_EOL;
$content .= '</div>' . PHP_EOL;
 
View user's profile Send private message
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1772

PostPosted: Thu May 30, 2013 6:30 pm Reply with quote

You don't need the table inside the div because you are using only one td. If you want make sure that the content is only for admins and users available you should put the include and the content in the if statement. Don't create a 'else' if you don't use it. In your case i would put a empty content variable as fallback in the 'else'. You should be careful with overriding the variable $module_name because if you are using the block in other modules it could break the whole module if you have the block on the left side before the module content was loaded.

_________________
Github: RavenNuke 
View user's profile Send private message
hicuxunicorniobestbuildpc







PostPosted: Fri May 31, 2013 2:27 am Reply with quote

Can u please give me an example. If I remove

Code:
if (is_admin($admin) OR (is_user($user))) {


Then my block brakes.

Quote:
You don't need the table inside the div


What is the best way to do it. I always get confuse the div and table.
 
neralex







PostPosted: Fri May 31, 2013 4:59 am Reply with quote

[ Only registered users can see links on this board! Get registered or login! ] [ Only registered users can see links on this board! Get registered or login! ]
 
Guardian2003
Site Admin



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

PostPosted: Fri May 31, 2013 2:36 pm Reply with quote

Code:
if (!defined('BLOCK_FILE')) {Header('Location: ../index.php');  die();}


global $admin, $user;
$content = '';

if (is_admin($admin) OR (is_user($user))) {
include_once 'modules/Media/go_config.php';
$content . = '<div class="text-center">' . PHP_EOL;
$content .= '<a href="modules/Media/popup_wimpy.php" target="popup" onclick="wimpypopup()" title="Wimpy Player!"><img src="images/ipod.jpg" alt="" border="0" /></a><br />' . PHP_EOL;
    } else {
echo 'Restricted Content';
    }

$content .= '</div>' . PHP_EOL;
 
View user's profile Send private message Send e-mail
hicuxunicorniobestbuildpc







PostPosted: Fri May 31, 2013 6:05 pm Reply with quote

Sorry Guardian but after applying your changes all blocks dissapear but

I did this and now I think I understand what neralex was saying. This one I did now it is validated and it is working fine. I don't understand why yours is not working Guardian.

Code:
<?php



if (!defined('BLOCK_FILE')) {Header('Location: ../index.php');  die();}
if (!defined('PHP_EOL')) define('PHP_EOL', strtoupper(substr(PHP_OS,0,3) == 'WIN') ? "\r\n" : "\n");

global $admin, $user;
$module_name = 'Media';

include_once 'modules/Media/go_config.php';

$content  = '<div class="text-center">' . PHP_EOL;
if (is_admin($admin) OR (is_user($user))) {
$content .= '<a href="modules/' . $module_name . '/popup_wimpy.php" target="popup" onclick="wimpypopup()" title="Click on me to pop up the Wimpy!"><img src="images/ipod.jpg" alt="" border="0" /></a><br />' . PHP_EOL;
    } else {
    }

$content .= '</div>' . PHP_EOL;
 
neralex







PostPosted: Fri May 31, 2013 6:43 pm Reply with quote

You make the same mistakes again... don't override the $module_name in blocks! The variable $module_name is set before the header include starts. The blocks are loaded after the header. In some modules it could be you are overwriting the module_name for the module, if you are using your block on the left side. Maybe if the module have the name 'My_Module' and you set now the $module_name new with 'Media', then you can brick the module because the variable have through your overriding a wrong value.
Example:

Code:
$module_name = 'x';

$module_name = 'y';
echo $module_name; # result is y



I think its a little typo in Guardians code.

change:

Code:
$content . = '<div class="text-center">' . PHP_EOL;


to:

Code:
$content .= '<div class="text-center">' . PHP_EOL;
 
hicuxunicorniobestbuildpc







PostPosted: Sat Jun 01, 2013 4:36 am Reply with quote

oops. U were right neralex. Now it is working fine.

Code:
<?php



if (!defined('BLOCK_FILE')) {Header('Location: ../index.php');  die();}
if (!defined('PHP_EOL')) define('PHP_EOL', strtoupper(substr(PHP_OS,0,3) == 'WIN') ? "\r\n" : "\n");
global $admin, $user;
$content = '';

if (is_admin($admin) OR (is_user($user))) {
include_once 'modules/Media/go_config.php';
$content .= '<div class="text-center">' . PHP_EOL;
$content .= '<a href="modules/Media/popup_wimpy.php" target="popup" onclick="wimpypopup()" title="Wimpy Player!"><img src="images/ipod.jpg" alt="" border="0" /></a><br />' . PHP_EOL;
    } else {
echo 'Restricted Content';
    }

$content .= '</div>' . PHP_EOL;
 
hicuxunicorniobestbuildpc







PostPosted: Sat Jun 01, 2013 4:49 am Reply with quote

Neralex, I think I have a little problem with validation.

My HTML Tidy plugin is telling me the site is validated but when u go to here
[ Only registered users can see links on this board! Get registered or login! ]

Then u see.

I removed the wimpy player block I still get the same result of more warnings. I don't understand that site anymore.


Shocked

I checked your site and It is giving the same result.
[ Only registered users can see links on this board! Get registered or login! ]
 
Guardian2003







PostPosted: Sun Jun 02, 2013 2:33 pm Reply with quote

Well the W3C page clarifies what the problem is and how to correct it. If markup validation is important, make sure to change your header content-type to text/xhtml and not text/html
 
neralex







PostPosted: Sun Jun 02, 2013 2:49 pm Reply with quote

hicuxunicorniobestbuildpc,

1. This is JS generated content through the RN boxover-script in the blocks of my gallery and we both had the discussion in the past so often but its full validated. I hate to repeat me for you again and again. That is totally offtopic and that have nothing to do with your wimpy block.

2. My gallery is not allowed on all your domains!

Wink
 
hicuxunicorniobestbuildpc







PostPosted: Mon Jun 03, 2013 5:26 am Reply with quote

Sorry to tell you neralex but it looks like you don't accept to be critized. You think you know all and learn some codes you can be an arrogant person and I think you are insulting me. You are really wrong and I keep on saying to you it is possible to make a watermark on pictures with another picture or text. Please stop complaining. Do your research instead of thinking you know all. When I installed your gallery I found lots of issues running your gallery on php 5.4. In one week thanks to all users who installed your gallery you could improve your module. If I remove your block my site is 100% validated. I know it is JS generated content but I repeat: It doesn't validate my site. Am I not allow to say that?. Are u the owner of my site? Please grow up and try to be friendly.
 
Guardian2003







PostPosted: Mon Jun 03, 2013 7:34 am Reply with quote

hicuxunicorniobestbuildpc - personal attacks against other members are not permitted here (as you know).
Please stick to your opening topic (Wimpy player block) to avoid getting others confused with what this topic is about as we seem to now be discussing different things.
 
neralex







PostPosted: Mon Jun 03, 2013 7:39 am Reply with quote

Don't cry, hicuxunicorniobestbuildpc! Smile

You can say what do you want but you are the reason for all these errors because you are creating all errors self. If you don't like the gallery, then remove it - very simple!

The discussions with you are endless and i don't want do the same things again and again with you. That was the reason why i have you banned on my site.

The reason for the disallow on your domains? You have tried to register with many fake-accounts on my website after the first ban. You have it done also on so many other sites. Thanks if you want help, but i don't need it because everytime you have destroyed some things and comes back with self created issues.

Wink
 
Guardian2003







PostPosted: Mon Jun 03, 2013 9:48 am Reply with quote

Looks like this toic has now reached it's end, so to prevent a flame war (and me hit the ban button myself), I will be locking this topic.
 
Display posts from previous:       
Post new topic   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

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 ©