Fiji Web Design
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Displaying modules conditionally? (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Displaying modules conditionally?
#779
icesar (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Displaying modules conditionally? 1 Year, 5 Months ago Karma: 0  
Hello! Thanks for your great module, I'm using the latest version with Joomla 1.5 and a custom template.

I'm trying to display either a contact form if a user is logged in OR a login form if he's not, using the PHP module. It works for the login form, but the contact form can't seem to access the database correctly. Here's what I have so far:

<?php

global $mainframe;

$md_user = & JFactory::getUser();   
$md_user_id = $md_user->get('id');   

if ($md_user_id) {

  $mod = JModuleHelper::getModule('mod_chronocontact', 'Ask a Soldier');
  $content = JModuleHelper::renderModule($mod);

} else {

  echo "<p>Please log in to ask a question.</p>";
  $mod = JModuleHelper::getModule('mod_cblogin', null);
  $content = JModuleHelper::renderModule($mod);

} 

?>
And the errors that I get are:
Notice: Undefined offset: 0 in C:\wamp\www\aec\modules\mod_chronocontact\helper.php on line 17

Notice: Trying to get property of non-object in C:\wamp\www\aec\modules\mod_chronocontact\helper.php on line 17

Notice: Undefined property: stdClass::$imagever in C:\wamp\www\aec\modules\mod_chronocontact\helper.php on line 19

Notice: Undefined offset: 0 in C:\wamp\www\aec\modules\mod_chronocontact\helper.php on line 24

Notice: Trying to get property of non-object in C:\wamp\www\aec\modules\mod_chronocontact\helper.php on line 24
There is no form with this name or may be the form is unpublished, Please check the form and the url and the form management
Basically, the code fails when it tries to access rows[0] after a query. Do you have any idea what might be going on?
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#780
admin (Admin)
Admin
Posts: 422
graph
User Offline Click here to see the profile of this user
Re:Displaying modules conditionally? 1 Year, 5 Months ago Karma: 9  
Does mod_chronocontact work outside mod_php? You can't tell here if its how you invoked the module, or the code in the module itself that is to blame.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#781
icesar (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Re:Displaying modules conditionally? 1 Year, 5 Months ago Karma: 0  
Hello -- yes, mod_chronocontact is working fine otherwise. It only seems to break down inside mod_php. The form that I am trying to embed can be used fine when loaded in the component area.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Joomla Downloads

DownloadsDownload our free Joomla! Components, Modules and Plugins.