Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Changing "standard" PHP to work in...
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/>';
}
}
}
}
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
- Index
- » MetaMod
- » MetaMod General Support
- » Changing "standard" PHP to work in...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Posts this week:
- 2
- User Info:
- Total Users:
- 7627
- Newest User:
- rudys68879
- Members Online:
- 0
- Guests Online:
- 184
- 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