Author |
Message |
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm

Joined: Aug 13, 2009
Posts: 1123
|
Posted:
Tue Jun 26, 2012 4:50 pm |
|
hey guys, I tried this block but it doesn't work with Ravennuke 2.5. I do want to learn asap what is the best way to pop up several images. Take a look at the whole block and let me know why it is not working.
Code:<?php
if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}
global $db, $prefix, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $currentlang;
////////////////////////////////////
// Input & Image sizes
$vhgt = "100";
$vwdth = "135";
$url11 = "http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isawmerc.gif"; // World
$url12 = "http://sirocco.accuweather.com/sat_mosaic_640x480_public/rs/isarUN.gif"; // USA
$url13 = "http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isaeur3.gif"; // Europe
$url14 = "http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isaaust.gif"; // Australia
$url15 = "http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isamex.gif"; // Mexico
$url16 = "http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isacar.gif"; // Carribean
$url17 = "http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isansam.gif"; // South America
$url18 = "http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isamide.gif"; // Middle East
$url19 = "http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isaindia.gif"; // India
// Not Linked....
$url20 = "http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isaafrn.gif"; // Africa
$url21 = "http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isaasia.gif"; // Asia
///
$defaultpict = $url13; // This is block default picture set from the above list
$content .= "<table width='100%' bgcolor='$bgcolor1' align='center' cellspacing='1' cellpadding='1' border='0'><tr><td>";
$content .= "<table width='100%' bgcolor='$bgcolor2' align='left' bgcolor='$bgcolor3' cellspacing='1' cellpadding='1' border='0'><tr><td>";
$content .= "<table width='100%' bgcolor='$bgcolor1' align='center' cellspacing='1' cellpadding='1' border='0'><tr><td>";
$content .= "<center><a href=\"javascript:PopupPic('$url13')\"><img src='$defaultpict' width='$vwdth' height='$vhgt' border='0' alt='Weather'></a></center>";
$content .= "<table width='100%' align='center' bgcolor='$bgcolor2' cellspacing=\"1\" cellpadding=\"0\" border=\"0\"><tr><td>";
$content .= "<center>";
$content .= "<a href=\"javascript:PopupPic('$url13')\"><b>EUR</b></a> | ";
$content .= "<a href=\"javascript:PopupPic('$url12')\"><b>USA</b></a> | ";
$content .= "<a href=\"javascript:PopupPic('$url11')\"><b>ATLAS</b></a> ";
$content .= "</td></tr></table>";
$content .= "</td></tr></table>";
$content .= "</td></tr></table>";
$content .= "</td></tr></table>";
?>
|
 |
|
|
|
 |
neralex
Site Admin

Joined: Aug 22, 2007
Posts: 1775
|
Posted:
Tue Jun 26, 2012 6:01 pm |
|
your block have a crazy old markup but its a easy way to optimize it!
try this one:
set $usecolorbox to 1 and you see the pics in a colorbox or set $usecolorbox to 0 and you have an oldschool popup
Code:<?php
if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}
$usecolorbox = 1;
if ($usecolorbox == 0) {
$popup = ' target="popup" onclick="popuppic();"';
} elseif ($usecolorbox == 1) {
$popup = ' rel="colorbox" class="popuppiccolb"';
}
////////////////////////////////////
// Input & Image sizes
$vhgt = '100';
$vwdth = '135';
$url11 = 'http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isawmerc.gif';
$url11title = 'World';
$url12 = 'http://sirocco.accuweather.com/sat_mosaic_640x480_public/rs/isarUN.gif';
$url12title = 'USA';
$url13 = 'http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isaeur3.gif';
$url13title = 'Europe';
$url14 = 'http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isaaust.gif';
$url14title = 'Australia';
$url15 = 'http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isamex.gif';
$url15title = 'Mexico';
$url16 = 'http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isacar.gif';
$url16title = 'Carribean';
$url17 = 'http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isansam.gif';
$url17title = 'South America';
$url18 = 'http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isamide.gif';
$url18title = 'Middle East';
$url19 = 'http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isaindia.gif';
$url19title = 'India';
// Not Linked....
$url20 = 'http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isaafrn.gif';
$url20title = 'Africa';
$url21 = 'http://sirocco.accuweather.com/sat_mosaic_640x480_public/IR/isaasia.gif';
$url21title = 'Asia';
///
$defaultpict = $url13; // This is block default picture set from the above list
$content = '<div class="text-center">' . PHP_EOL;
$content .= ' <a ' . $popup . ' href="' . $url13 . '" title="' . $url13title . '"><img src="' . $defaultpict . '" style="width:' . $vwdth . 'px; height:' . $vhgt . 'px" border="0" alt="Weather" /></a>' . PHP_EOL;
$content .= '</div>' . PHP_EOL;
$content .= '<div class="text-center">' . PHP_EOL;
$content .= ' <a ' . $popup . ' href="' . $url13 . '" title="' . $url13title . '"><b>EUR</b></a> | ' . PHP_EOL;
$content .= ' <a ' . $popup . ' href="' . $url12 . '" title="' . $url12title . '"><b>USA</b></a> | ' . PHP_EOL;
$content .= ' <a ' . $popup . ' href="' . $url11 . '" title="' . $url11title . '"><b>ATLAS</b></a>' . PHP_EOL;
$content .= '</div>' . PHP_EOL;
if ($usecolorbox == 0) {
$popuppic = '<script type="text/javascript">' . PHP_EOL;
$popuppic .= ' function popuppic(){ window.open (\'\', \'popup\', \'width=640, height=480, scrollbars=no, toolbar=no, status=no, resizable=yes, menubar=no, location=no, directories=no, top=300\'); }' . PHP_EOL;
$popuppic .= '</script>' . PHP_EOL;
addJSToBody($popuppic,'inline');
} elseif ($usecolorbox == 1) {
$popuppiccolb = '<script type="text/javascript">' . PHP_EOL;
$popuppiccolb .= '$(document).ready(function(){$(".popuppiccolb").colorbox({slideshow:false, scalePhotos:true, maxWidth:"800px", maxHeight:"600px"});});' . PHP_EOL;
$popuppiccolb .= '</script>' . PHP_EOL;
addJSToBody($popuppiccolb, 'inline');
}
?>
|
Edit: i have it shorted again
 |
|
|
|
 |
hicuxunicorniobestbuildpc

|
Posted:
Tue Jun 26, 2012 8:17 pm |
|
Thanks neralex, it is working pretty well buddy.
I still need to learn the way Ravennuke load javascript.
Isn't that better to create a file in the addon folder?
head-satellite.php
I'm getting confused with this.
 |
|
|
|
 |
neralex

|
Posted:
Wed Jun 27, 2012 4:22 am |
|
You can found in the RN wiki an faq for this:
http://rnwiki.ravennuke.com/wiki/RavenNuke2:Loading_CSS_and_JavaScript
If you have some more js calls inside your theme, then it is better you put all your js codes in one file and put the call of the js file in a custom-file, for expample custom-foot.php or custom-head.php inside the includes/custom_files folder. But you can create an addon-file, too. Its the same way.
Its not needed to load every js code in the head. If you have many js code in the head, then your site loads longer before you see the content. Little js calls and the most of jQuery codelines can be loaded at the bottom of the body.
 |
|
|
|
 |
hicuxunicorniobestbuildpc

|
Posted:
Wed Jun 27, 2012 6:48 am |
|
Thanks for the explanation. I would like examples from loading js codes to compare. |
|
|
|
 |
neralex

|
Posted:
Wed Jun 27, 2012 8:42 am |
|
you have a body inline example in your block:
Code:$popuppiccolb = '<script type="text/javascript">' . PHP_EOL;
$popuppiccolb .= '$(document).ready(function(){$(".popuppiccolb").colorbox({slideshow:false, scalePhotos:true, maxWidth:"800px", maxHeight:"600px"});});' . PHP_EOL;
$popuppiccolb .= '</script>' . PHP_EOL;
addJSToBody($popuppiccolb, 'inline');
|
file body example:
Code:addJSToBody('path/to/your/codefile.js', 'file');
|
if you want load js code into the head, then use addJSToHead and you must put the lines before the include of the header.php! |
|
|
|
 |
hicuxunicorniobestbuildpc

|
Posted:
Wed Jun 27, 2012 3:58 pm |
|
Thanks for the example. I will take into account next time although it is always different. |
|
|
|
 |
|