Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Changing "standard" PHP to work in MetaMod Joomla module

Changing "standard" PHP to work in MetaMod Joomla module

I learnt some php and wrote this module because I couldn't find anything that would do what I wanted.
The module works perfectly under wamp and php but when I transfer it to Joomla in a MetaMod module I get what I think are I/O errors
An extract is below. Can someone suggest.where I might be going wrong.

Code:


searchpath = JPATH_COMPONENT . DS . "images/";

$option=0 /* "0"=debug listing, "1"=day of month  */;
$offset=0 /* use where want to advance the indexing */;
$dayofmonth=date("d");
//
$handle=JFolder::files($searchpath,'.jpg');
//
// get value we need
switch ($option) {
    case 0:
        // zero is debug listing, list all files;
        listing($handle);
       //  pass handle and do subroutine
             break;
    case 1:
            // day of month;
            $periodValue=$dayofmonth;
            echo displayimage ($periodValue,$handle,$offset);
             break;

}

function listing ($handle)
{

echo '<br>-Debug subroutine list images in directory<br>';
echo '=========================================<br>';
//
          while(file=JFolder::files($searchpath, '.jpg'){
            if($file !== '.' && $file !== '..' ){
                echo 'images/'.$file. ' ';
                ECHO ' <br/>';
        }
        }
}
}

pd4pbyc
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Re: Changing "standard" PHP to work in MetaMod Joomla module

Hi,

the main issue may be that you are using a function called displayimage() which does not exist in Joomla or is a built-in function in PHP. Did your original code define that function somewhere?

I haven't looked too closely at the rest of the code, but that problem would be enough to stop it working I think.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1685
Total Polls:
6
Total Posts:
5940
Total Posts Today:
1
User Info:
 
Total Users:
5186
Newest User:
Totosite
Members Online:
0
Guests Online:
222

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked