Section and Sub Section intro text

6 posts by 3 authors in: Forums > CMS Builder
Last Post: July 23, 2010   (RSS)

By svsanchez - July 19, 2010

Dear sirs:

My site has many sections and sub sections and I would like to show only an intro when a user selects a section before showing the list of articles on a subsection. Say I have a main category called "CEILINGS" with 7 different subcategories, each with a few articles. When the user selects "CEILINGS" I don't want to show him the articles but ONLY the intro for that category. When the user selects a subcategory then I will show him the articles on that subcategory.

How can I achieve this?
Sven Sanchez

www.deguate.com

Re: [chris] Section and Sub Section intro text

By svsanchez - July 22, 2010

Hi Chris, I don't know how to set the depth to 0 to show the intros. I am pasting here my code as I don't understand what you mean by how I'm generating my menus:

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';




$dirsToCheck = array('/home/casahem/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records

list($categoryRecords, $selectedCategory) = getCategories(array( 'tableName' => 'categories', 'categoryFormat' => 'twolevel', ));
list($articlesRecords, $articlesMetaData) = getRecords(array(
'tableName' => 'articles',

));









?>


<html>

<head>
<meta http-equiv="Content-Language" content="es-gt">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>$record['title']</title>
</head>

<body bgcolor="#333333" topmargin="0" leftmargin="0" link="#F64B00" vlink="#F64B00">

<table border="0" cellpadding="2" cellspacing="0" width="1000" id="table1" bgcolor="#FFFFFF">
<tr>
<td width="173">
<p align="center"><img border="0" src="images/index.1.jpg" width="150" height="149"></td>
<td>
<div align="center">
<table border="1" cellpadding="0" cellspacing="0" width="728" id="table5" height="90" bgcolor="#F64B00" bordercolor="#000080">
<tr>
<td>
<p align="center">BANNER 728x90</td>
</tr>
</table>
</div>
<p align="right"><b><font face="Tahoma" size="2" color="#000080">Inicio&nbsp;
|&nbsp; Qui?es Somos&nbsp;&nbsp; |&nbsp;&nbsp; Contacto&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</font></b></td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" width="1000" id="table3" bgcolor="#FFFFFF">
<tr>
<td width="175" valign="top" style="border-right: 1px dotted #808080">
<p>


<font face="Tahoma" size="2">


<?php $selectedCat=""; ?> <?php foreach($categoryRecords as $category):?> <?php if(!$category['_hasParent']):?> <!--<?php echo $category['_listItemStart']; ?>--> <?php if($category['_isSelectedBranch']){echo "<b>"; $selectedCat=$category['num'];} ?> <a href="?category=<?php echo $category['num']?>"><?php echo $category['name']; ?></a> <?php if($category['_isSelectedBranch']){echo "</b>";} ?> <!--<?php echo $category['_listItemEnd']; ?>--> <?php endif ?>
</font> <p> <font face="Tahoma" size="2"> <?php endforeach ?>



</font>



</p>
<p align="center"><b><font face="Tahoma" size="2" color="#666666">
--------------------------</font></b></p>
<form method="POST" action="--WEBBOT-SELF--" onSubmit="">
<!--webbot bot="SaveResults" U-File="_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" i-checksum="43374" endspan -->
<p><b><font face="Tahoma" size="2" color="#808080">Buscar:</font><font face="Tahoma" size="2" color="#666666"><br>
</font></b><input type="text" name="T1" size="17">
<input type="submit" value="Ok" name="B1" style="font-family: Tahoma; font-size: 10pt; color: #FFFFFF; background-color: #01009E"></p>
</form>
</td>
<td width="175" valign="top">


<font face="Tahoma" size="2">


<?php if($selectedCat): ?> <?php foreach($categoryRecords as $category): ?> <?php if ($selectedCat==$category['parentNum']):?> <!--<?php echo $category['_listItemStart']; ?>--> <a href="?category=<?php echo $category['num']?>"> <?php echo $category['name']; ?> </a> <!--<?php echo $category['_listItemEnd']; ?>--> <?php endif ?> <p> <?php endforeach ?> <?php endif ?>


</font>


</td>
<td width="650" valign="top">



<font face="Arial" size="2"><font color="#666666">


<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<?php foreach ($articlesRecords as $record): ?>






</font></font><b>
<font face="Arial" size="4" color="#000080"> <?php echo $record['title'] ?></font></b><font face="Arial" size="2" color="#666666"><br/>
<?php echo $record['intro'] ?></font><p>
<font face="Arial" size="2" color="#666666">Category: <?php echo $record['category'] ?><br/>
_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>

</p>

<hr/>
<?php endforeach ?>

<?php if (!$articlesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->






<font face="Arial" size="2">


</td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" width="1000" id="table4">
<tr>
<td bgcolor="#666666">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#CCCCCC">&nbsp;</td>
</tr>
</table>

</body>

</html>
Sven Sanchez

www.deguate.com

Re: [svsanchez] Section and Sub Section intro text

By Chris - July 22, 2010

Hi svsanchez,

This may take some experimentation, but I'd start with this...

Put this code around your STEP 2 code: (new code in red)

<?php if ($selectedCategory['depth'] == 0): ?>
<?php echo $selectedCategory['content'] ?>
<?php else ?>


<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<?php foreach ($articlesRecords as $record): ?>






</font></font><b>
<font face="Arial" size="4" color="#000080"> <?php echo $record['title'] ?></font></b><font face="Arial" size="2" color="#666666"><br/>
<?php echo $record['intro'] ?></font><p>
<font face="Arial" size="2" color="#666666">Category: <?php echo $record['category'] ?><br/>
_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>

</p>

<hr/>
<?php endforeach ?>

<?php if (!$articlesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->

<?php endif ?>


Does that do what you want?
All the best,
Chris

Re: [chris] Section and Sub Section intro text

By svsanchez - July 22, 2010

Hi Chris, it didn't work, I am now getting this error:

Parse error: syntax error, unexpected ';', expecting ':' in /home/casahem/public_html/articulos.php on line 121

Here's what I have:

<?php if ($selectedCategory['depth'] == 0): ?>
<?php echo $selectedCategory['content'] ?>
<?php else ?>


<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<?php foreach ($articlesRecords as $record): ?>

</font></font><b>
<font face="Arial" size="4" color="#000080"> <?php echo $record['title'] ?></font></b><font face="Arial" size="2" color="#666666"><br/>
<?php echo $record['intro'] ?></font><p>
<font face="Arial" size="2" color="#666666">Category: <?php echo $record['category'] ?><br/>
_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>

</p>

<hr/>
<?php endforeach ?>

<?php if (!$articlesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->


<?php endif ?>


What am I doing wrong?
Sven Sanchez

www.deguate.com

Re: [svsanchez] Section and Sub Section intro text

By Donna - July 23, 2010

Hi there :)

Can you let me know specifically what's on line 121 (and a couple of lines around it)?
Donna

--
support@interactivetools.com