Category on top...

8 posts by 4 authors in: Forums > CMS Builder
Last Post: November 16, 2016   (RSS)

By osga - November 10, 2016

We would like to place the name of the category corresponding to the article shown on the srticle page at the top of the page.

Referring to this page, we would like to replace the title "NEWS" at the top, with the name of the category of the article shown:

http://www.osga.com/mobile/article_blank.php/online_gaming_articles.php?SEC-Subpoenas-Nevada-Entity-Wagering-Funds-For-Information-18093

I've tried replacinc "NEWS" with code like <?php echo htmlencode($categoryRecord['parentNum']) ?>

and others, but there must be something at the top of the article template php that im missing?

By ross - November 10, 2016

Hi there.

Thanks for posting.

What I think you'll need is something like this:

<?php echo htmlencode($articleRecord['category:label']) ?>

Notice how I am using the "articleRecord" array instead of the "categoryRecord" array.  Your article record array might have a different name so make sure to update my code example.

Let me know if this works for you.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By osga - November 10, 2016

that one gave me an error..

i can throw these in <?php echo $articlesRecord['art_field1'] ?>, and they work, just nothing using "Category" (so far)

By ross - November 11, 2016

Could you attach a copy of your page to a reply? I'd like to review your code.

Please don't just paste all the code into your reply.

Thanks.

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By osga - November 11, 2016

here ya go...

Attachments:

article_blank.php 9K

By osga - November 16, 2016 - edited: November 16, 2016

Excellent Greg, thank you! The top one worked perfectly! Cheers!

In the same vein... is there a way to hide the parent category in the string? So instead of seeing "Sport: Football: NFL" it would be just "NFL"? not a dealbreaker, but I thought I would ask...

By Damon - November 16, 2016

Hi,

Add this CMS Builder function to the page to display all the available variables that you can use:

<?php showme($articlesRecord); ?>

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/