Forums

Single page

geeknet 27 Aug, 2009
Hello,

I've been reading and searching for the right code to use, but I can find it anywhere.

I have this form that collects information and show the result using connectivity.
the result is arrange in list and each row is different.

What I need now is to make a single page for each row to show all the complete information.

Hope somebody can help me, thanks in advance.

Roy
GreyHead 27 Aug, 2009
Hi Roy,

You can do this with a ChronoForm that has no form fields. Just use the Form HTML to display the information from the database record. Link to the form with a record identifier in the URL from CC.

I did one a while ago using a smoothbox to display the record. Here's the <td> from the ChronoConnectivity body
<td><a href="http://etude.greyhead.net/index.php?option=com_chronocontact&chronoformname=cc_show_schools&task=extra&height=500&width=400&tmpl=component&ls_id={ls_id}" title="<b>{cLsName}</b>" class="smoothbox" id='{ls_id}' >Vue</a>
<div id="cccontent_{ls_id}_tip" style="display: none;">{cLsName} :: </div></td>
and I had this code in the 'Extra Code 1' box of the ChronoForm.
<?php
require_once(JPATH_BASE.DS.'components'.DS.'com_chronoconnectivity'
    .DS.'includes'.DS.'language_schools_1'.DS.'name_arrays.php');
$ls_id = JRequest::getString('ls_id', '', 'get');
if ( !$ls_id ) {
    echo "Sorry, the school was not found";
} else {
    $style = "
    .label {
    	color:#888;
    	text-align:right;
    }
    ";
  $db =& JFactory::getDBO();
  $query = "
    SELECT *
      FROM `#__et_language_schools`
      WHERE `ls_id` = '$ls_id' ;
  ";
  $db->setQuery($query);
  $school = $db->loadObject();
  $school->Category = $cat_array[$school->Category];
  $school->cLsRegion = $reg_array[$school->cLsRegion];
  $school->Dept = $dep_array[$school->Dept];
  if ( $school->cLsWebsite ) {
      $school->cLsWebsite = "<a href='http://".$school->cLsWebsite."' target='_blank'>".$school->cLsWebsite."</a>";
  }
  $query = "
    SELECT *
      FROM `#__et_ls_results`
      WHERE `ls_id` = '$ls_id'
      ORDER by `Year` ASC;
  ";
  $db->setQuery($query);
  $years = $db->loadObjectList();
//echo "<div>".print_r($school, true)."</div>";
  echo "<div style='font-weight:bold; color:#0089CF;'>Fiche Organisme</div>";
  echo "<table style='width:100%;'>
  	<tr><td style='width:30%;' class='label' >Catégorie:</td><td> ".$school->Category."</td></tr>
  	<tr><td class='label' >Raison Sociale:</td><td> ".$school->cLsName."</td></tr>
  	<tr><td class='label' >Adresse:</td><td> ".$school->cLsAddr."</td></tr>
  	<tr><td class='label' >Code postal:</td><td> ".$school->cLsCodepostal."</td></tr>
  	<tr><td class='label' >Ville:</td><td> ".$school->cLsVille."</td></tr>
  	<tr><td class='label' >Région:</td><td> ".$school->cLsRegion."</td></tr>
  	<tr><td class='label' >Department:</td><td> ".$school->Dept."</td></tr>
  	<tr><td class='label' >Site web:</td><td> ".$school->cLsWebsite."</td></tr>
  	<tr><td class='label' >Téléphone:</td><td> ".$school->cLsPhone."</td></tr>
  	<tr><td class='label' >Statut:</td><td> ".$school->cLsStatut."</td></tr>
  	<tr><td class='label' >RCS:</td><td> ".$school->cLsTcs."</td></tr>
  	<tr><td class='label' >Date de création:</td><td> ".$school->cLsCreationdate."</td></tr>
  	<tr><td class='label' >Certification Qualité:</td><td> ".$school->cLsCertificationQualite."</td></tr>
  	<tr><td class='label' >No centres:</td><td> ".$school->cLsCentres."</td></tr>
  	<tr><td class='label' >Nom reseau:</td><td> ".$school->cLsNomreseau."</td></tr>";
    if ( !empty($years) ) {
        echo "<tr><td colspan='2'>
  		 <table style='text-align:right; width:100%;' >
         	<tr><thead>
         	<th> </th>
         	<th>CA</th>
         	<th>Result</th>
         	<th> </th>
         	<th style='text-align:left;'>Commentaires</th><thead></tr>";
        foreach ( $years as $year ) {
            if ( $year->cLsCa2007 == -1 ) {
                $year->cLsCa2007 = 'non publié';
            } elseif ( !$year->cLsCa2007 ) {
                $year->cLsCa2007 = '–';
            } else {
                $year->cLsCa2007 = number_format($year->cLsCa2007, 0, ',', ' ');
            }
            if ( $year->cLsResult2007 == -1 ) {
                $year->cLsResult2007 = 'non publié';
            } elseif ( !$year->cLsResult2007 ) {
                $year->cLsResult2007 = '–';
            } else {
                $year->cLsResult2007 = number_format($year->cLsResult2007, 0, ',', ' ');
            }
            if ( !$year->Notes ) {
                $year->Notes = '  –';
            } elseif ( $year->Notes == 'D' ) {
                $year->Notes = 'déclaré lors d l’enquête';
            } elseif ( $year->Notes == 'E' ) {
                $year->Notes = 'estimé';
            }
            echo "<tr><td>".$year->Year."</td>
              		<td >".$year->cLsCa2007."</td>
                    <td>".$year->cLsResult2007."</td>
                    <td> </td>
                    <td style='text-align:left;'>".$year->Notes."</td></tr>";
        }
        echo  "</table>
          </td></tr>";
    }
  	echo "</table>";
  	$doc =& JFactory::getDocument();
  	$doc->addStyleDeclaration($style);
}
?>

Note the &tmpl=component in the calling url to hide the template in the smoothbox.

Bob
geeknet 27 Aug, 2009
wow that was a lot,

how do i start, what is a smoothbox.

Roy
GreyHead 01 Sep, 2009
Hi Roy,

A smoothbox is the Joomla Popup window that shows you something in an overlaid page. See the image below which is showing the details of a single record from the ChronoConnectivity table by clicking a 'View' link.

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