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: [svsanchez] Section and Sub Section intro text

By Chris - July 19, 2010

Hi svsanchez,

There are many ways to set this up. If you're using a Category Menu it's as simple as checking the "depth" of the selected category and displaying a different page if it's 0.

How are you generating your menu of sections and subsections -- and how are you displaying your pages?
All the best,
Chris

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