Forums

CC in a module

yigal 24 Sep, 2009
Is it possible at all?
I'm willing to do a lot for this.
I need to display two CC instances in one page, so a module will solve my problems, if you have any other idea you're welcome.
GreyHead 24 Sep, 2009
Hi yigal,

I've no idea - I haven't heard of anyone trying to get two CC instances on one page.

Can you say a bit more about what you need to show?

Max has talked about a module for CC but I don't think any work ahs been done on it. Possibly Jumi or DisplayContent would help?

Bob
yigal 24 Sep, 2009
I'll look into those options.

I have menu which is having a specific items names for each user, maybe the following code will explain itself:
{edit_record}<p>
<a href="../index.php?option=com_chronoconnectivity&Itemid=8">{text_8}</a><br />
<a href="../index.php?option=com_chronoconnectivity&Itemid=7">{text_7}</a><br />
<a href="../index.php?option=com_chronoconnectivity&Itemid=6">{text_6}</a> <br />
<a href="../index.php?option=com_chronoconnectivity&Itemid=5">{text_5}</a> <br />
<a href="../index.php?option=com_chronoconnectivity&Itemid=4">{text_4}</a> <br />


You see, the connections link stays the same for each user, only the text changes.
Anyway, I want to display this nice dynamic menu along with the connections themself on the same page.
GreyHead 04 Oct, 2009
Hi yigal,

If the menu is going into a module then I'd be inclined to generate it using Jumi (you can include a little db query and some php to create the link list). But I may be misunderstanding exactly what you need to do here :-(

Bob
yigal 04 Oct, 2009
I think you got what I need.
Where should I take the code from?
GreyHead 04 Oct, 2009
Hi yigal,

Where do {text_4} . . . {text_7} come from - a single database record?

Bob
GreyHead 05 Oct, 2009
Hi Yigal,

Then the code will be something like this
<?php
$user =& JFactory::getUser();
if ( $user->id ) {
  // this is a guest
  return;
} 
$db =& JFactory::getDBO();
$query = "
  SELECT * 
    FROM `#__some_table`
    WHERE `some_column` = ".$user->id." ;
";
$db->setQuery($query);
$result = $db->loadObject();
?>
<div><a href='index.php?option=com_chronocontact&chronoformname=some_form&task=editrecord&id=".$result->id."'>Edit Record</a></div>
<?php
for ( $i = 8; $i >= 4; $i-- ) {
  $text = 'text_'.$i;
  echo "<a href='../index.php?option=com_chronoconnectivity&Itemid=$i'>".$result->$text."</a><br />";
}
?>
Not tested and will need debugging, in particular the edit record url is made up.

Bob
This topic is locked and no more replies can be posted.