Hi
I have an issue regarding the parameters from the url.
I am starting to understand how a component works but I can t figure it out why this is not working:
I have a component with 2 options: view_list (which list all the items) and show_item (which show a single item)
in my dailymessage.php I have a switch for the choice. this switch depends on the condition: task in the url:
Quote:
$task = mosGetParam( $_REQUEST, 'task');
switch ($task) {
case 'view':
default:
view_list();
break;
case 'show':
show_item();
break;
}
function view_list(){
global $database;
$database->setQuery("SELECT * FROM #__joe_dailymessage WHERE published = '1'");
$rows = $database->loadObjectList();
dailymessage_HTML::view_list_html($rows);
}
function show_item(){
global $database;
$iditem = mosGetParam($_REQUEST, 'iditem');
$database->setQuery("SELECT * FROM #__joe_dailymessage" . "WHERE id='.$iditem.' AND published = '1'");
$rows = $database->loadObjectList();
dailymessage_HTML::show_item_html($rows);
}
|
If I do things the way I think, when the component is started, the function view_list will be started (cause no task). in my list I created a link for each item:
Quote:
|
<td class="more_details"><a href="index.php?option=com_dailymessage&task=show& iditem=<?php echo $row->id;?>">More Details >></a></td>
|
when clicking on this link the url will be with task=show. so the show_item should start... but it doesnt..
when I do an echo $task; that give me 0... so I guess ny mosGetparam is not working.
My second problem will be that: when clicking on the link "more detail" the page that is shown, is displayed in the default template. is it possible to display the pages with the parent template? because it is a component I cant assign it from the admin mode.
Any hints
please?
Yann