php function script not getting called in joomla -
i have created carousel html page call php functions getting run
<?php function getpicturetype($ext) { if ( preg_match('/jpg|jpeg/i', $ext) ) { return 'jpg'; } else if ( preg_match('/png/i', $ext) ) { return 'png'; } else if ( preg_match('/gif/i', $ext) ) { return 'gif'; } else { return ''; } } function getpictures($id) { global $max_width, $max_height; $dir="../../images/albums/album".$id."/"; $i = 0; if (is_dir($dir)) { if ($dh = opendir($dir)) { echo '<ul >'; while (($file = readdir($dh)) !== false) { if ( !is_dir($file) ) { $absolute_path = $dir.'thumbs'; $split = explode('.', $file); $ext = $split[count($split) - 1]; $textfile = $dir.$split[0].'.txt'; if (file_exists($textfile)) { $description = file_get_contents($textfile); } if ( ($type = getpicturetype($ext)) == '' ) { continue; } if ($i == 0) { echo $i; echo '<a href="'.$dir.$file.'" rel="lightbox['.$id.']" title="'.$description.'"><div class="linkicon"><i class="icon-plus-circled"></i></div></a>'; } else { echo $i; echo '<a href="'.$dir.$file.'" rel="lightbox['.$id.']" title="'.$description.'"></a>'; } $i=$i+1; } } echo '</ul>'; closedir($dh); } } } ?>
i call them in html
<div class="hovercover" style="opacity: 0;"> <?php getpictures(1); ?> </div>
this builds lightbox no problems.
i have tried create module using same code in default.php file <$php getpictures(1); ?>
function not being called , lightbox images not being generated. default.php looks this
defined('_jexec') or die('restricted access'); // no direct access // document object $doc =& jfactory::getdocument(); // add stylesheet $doc->addstylesheet( 'modules/mod_hot_joomla_carousel/tmpl/style.css' ); // add lightbox stylesheet $doc->addstylesheet( 'modules/mod_hot_joomla_carousel/tmpl/lightbox.css' ); ?> <?php if ($enablejquery!=0) { ?> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8./jquery.min.js"></script> <?php } ?> <!-- carousel plugin --> <script type="text/javascript" src="<?php echo $mosconfig_live_site; ?>/modules/mod_hot_joomla_carousel/js/jquery.caroufredsel-6.2.1-packed.js"></script> <!-- lightbox plugins --> <script type="text/javascript" src="<?php echo $mosconfig_live_site; ?>/modules/mod_hot_joomla_carousel/js/lightbox.js"></script> <!-- optionally include helper plugins --> <script type="text/javascript" src="<?php echo $mosconfig_live_site; ?>/modules /mod_hot_joomla_carousel/js/helper-plugins/jquery.mousewheel.min.js"></script> <script type="text/javascript" src="<?php echo $mosconfig_live_site; ?>/modules/mod_hot_joomla_carousel/js/helper-plugins/jquery.touchswipe.min.js"></script> <script type="text/javascript" src="<?php echo $mosconfig_live_site; ?>/modules/mod_hot_joomla_carousel/js/helper-plugins/jquery.transit.min.js"></script> <script type="text/javascript" src="<?php echo $mosconfig_live_site; ?>/modules/mod_hot_joomla_carousel/js/helper-plugins/jquery.ba-throttle-debounce.min.js"></script> <script type="text/javascript"> jquery(function() { // scrolled user interaction jquery('#foo2').caroufredsel({ auto: false, prev: '#foo2_prev', next: '#foo2_next', mousewheel: true, swipe: { onmouse: true, ontouch: true } }); }); </script> <?php function getpicturetype($ext) { if ( preg_match('/jpg|jpeg/i', $ext) ) { return 'jpg'; } else if ( preg_match('/png/i', $ext) ) { return 'png'; } else if ( preg_match('/gif/i', $ext) ) { return 'gif'; } else { return ''; } } function getpictures($id) { global $max_width, $max_height; $dir="../../images/albums/album".$id."/"; $i = 0; if (is_dir($dir)) { if ($dh = opendir($dir)) { echo '<ul >'; while (($file = readdir($dh)) !== false) { if ( !is_dir($file) ) { $absolute_path = $dir.'thumbs'; $split = explode('.', $file); $ext = $split[count($split) - 1]; $textfile = $dir.$split[0].'.txt'; if (file_exists($textfile)) { $description = file_get_contents($textfile); } if ( ($type = getpicturetype($ext)) == '' ) { continue; } if ($i == 0) { echo $i; echo '<a href="'.$dir.$file.'" rel="lightbox['.$id.']" title="'.$description.'"><div class="linkicon"><i class="icon-plus-circled"></i></div></a>'; } else { echo $i; echo '<a href="'.$dir.$file.'" rel="lightbox['.$id.']" title="'.$description.'"></a>'; } $i=$i+1; } } echo '</ul>'; closedir($dh); } } } ?> <div class="divide30"></div> <div class="wrapper whitebg"> <div class="divide20"></div> <div class="image_carousel"> <div class="overflowholder" style="height: 350px;"> <ul id="foo2" style="width: 1920px; left: 0px; height: 303px;"> <!-- image 1 --> <li style="width: 223px;"> <div class="mediaholder"> <div class="mediaholder_innerwrap"> <img src="/../images/albums/album1/thumbs/thumb1.jpg" title="image 1"/> <div class="hovercover" style="opacity: 0;"> <?php getpictures(1); ?> </div> </div> </div> <div class="detailholder"> <div class="divide20"></div> <div class="projects-title"> <a href="#"><?php echo $name1; ?></a> </div> <div class="divide15"></div> <div class="projects-desc"> <?php echo $description1; ?> </div> </div> </li> <!-- image 2 --> <li style="width: 223px;"> <div class="mediaholder"> <div class="mediaholder_innerwrap"> <img src="/../images/albums/album2/thumbs/thumb2.jpg" title="image 2"/> <div class="hovercover" style="opacity: 0;"> </div> </div> </div> <div class="detailholder"> <div class="divide20"></div> <div class="projects-title"> <a href="#"><?php echo $name2; ?></a> </div> <div class="divide15"></div> <div class="projects-desc"> <?php echo $description2; ?> </div> </div> </li> <!-- image 3 --> <li style="width: 223px;"> <div class="mediaholder"> <div class="mediaholder_innerwrap"> <img src="/../images/albums/album3/thumbs/thumb3.jpg" title="image 3"/> <div class="hovercover" style="opacity: 0;"> </div> </div> </div> <div class="detailholder"> <div class="divide20"></div> <div class="projects-title"> <a href="#"><?php echo $name3; ?></a> </div> <div class="divide15"></div> <div class="projects-desc"> <?php echo $description3; ?> </div> </div> </li> <!-- image 4 --> <li style="width: 223px;"> <div class="mediaholder"> <div class="mediaholder_innerwrap"> <img src="/../images/albums/album4/thumbs/thumb4.jpg" title="image 4"/> <div class="hovercover" style="opacity: 0;"> </div> </div> </div> <div class="detailholder"> <div class="divide20"></div> <div class="projects-title"> <a href="#"><?php echo $name4; ?></a> </div> <div class="divide15"></div> <div class="projects-desc"> <?php echo $description4; ?> </div> </div> </li> <!-- image 5 --> <li style="width: 223px;"> <div class="mediaholder"> <div class="mediaholder_innerwrap"> <img src="/../images/albums/album5/thumbs/thumb5.jpg" title="image 5"/> <div class="hovercover" style="opacity: 0;"> </div> </div> </div> <div class="detailholder"> <div class="divide20"></div> <div class="projects-title"> <a href="#"><?php echo $name5; ?></a> </div> <div class="divide15"></div> <div class="projects-desc"> <?php echo $description5; ?> </div> </div> </li> <!-- image 6 --> <li style="width: 223px;"> <div class="mediaholder"> <div class="mediaholder_innerwrap"> <img src="/../images/albums/album6/thumbs/thumb6.jpg" title="image 6"/> <div class="hovercover" style="opacity: 0;"> </div> </div> </div> <div class="detailholder"> <div class="divide20"></div> <div class="projects-title"> <a href="#"><?php echo $name6; ?></a> </div> <div class="divide15"></div> <div class="projects-desc"> <?php echo $description6; ?> </div> </div> </li> </ul> </div> </div> <div class="clearfix"></div> <a class="prev" id="foo2_prev" href="#"><span>prev</span></a> <a class="next" id="foo2_next" href="#"><span>next</span></a> </div>
why getpictures function not getting called, position of php functions or way im calling them on page
where defind $mosconfig_live_site
value
try read http://docs.joomla.org/creating_a_simple_module
try give full url/path on each included files
like:- juri::root().'css/joomla.css';
Comments
Post a Comment