Multiple Specific articles in one page

10 posts by 3 authors in: Forums > CMS Builder
Last Post: June 24, 2016   (RSS)

By osga - June 21, 2016

Hi Guys!

We are trying to call different individual headlines into one table on a page... i.e.:

Company X   |   Specific Art Headline/link on Company X  |  ...

Company Y   |   Specific Art Headline/link on Company Y  |  ...

Company Z   |   Specific Art Headline/link on Company Z  |  ...

this is the page we're working on:
http://www.osga.com/casinotest2016.html

By osga - June 22, 2016

we have individual articles in cms for each of the company names listed in the table, we would like the headline of those articles to be fed in the 2nd column of the table.  the column under "bonus Info" is where the headlines should be showing up...

By gregThomas - June 22, 2016

Hey Osga, 

This is my understanding of the issue:

  • You have one section that stores the company names
  • You have another section that stores the articles, one of the fields in this section is headline. 
  • These two sections are linked using a list field. I'm guessing that the article section has a list field that allows you to select a company from a drop down?

You're trying to work out how you can get the linked article for each business and display it? 

Is the above correct? Would it be possible to post the code for casinotest2016.html so I can see how the current system is set up?

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By osga - June 22, 2016

I apologize for having such a tough time explaining our issue. 

The company names in the table are irrelevant to the issue, they are just simple links to the actual companies themselves, done deal, no work needed there.

The problem comes in column 2, labeled as "Bonus Information". Now, for each one of the companies in the list, we have a page in cms, with the corresponding bonus offer that company supplies. We are trying to get the headline of that bonus page to appear on the list next to its appropriate company name.

theres no cms code on that page at this point we dont know what code to use to call different specific pages in one table.

         NAME                                             BONUS INFO...

Company X (simple link)  |   Company X Bonus Headline (CMS artNum-1234)  |  ...

Company Y (simple link)  |   Company Y Bonus Headline (CMS artNum-5678)  |  ...

Company Z (simple link)  |   Company Z Bonus Headline (CMS artNum-9012)  |  ...

We would rather have a feed for the headline as opposed to just a link to the art so the headline updates itself... I hope im getting clearer lol!

By gregThomas - June 22, 2016

Hey Osga, 

Thanks for those extra details, I think I understand what's required now.

So looking at your previous code you've got access to the article numbers (artNum-1234, artNum-5678, etc), you just need to get the content for each one. 

Have you looked at the code generator that's built into CMS Builder? If you go to General Settings > Code Generator > Detail Page, there is a specific option for loading content based on a records num value; Custom: Load Record # (See attached screenshot). So if you entered 1234 into the custom load box, example code to load that record and its content will be displayed.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By osga - June 24, 2016 - edited: June 24, 2016

well the issue with that is it puts the artNum in the 'where' => "`num` = '8278'", in the top set of code, which i assume means that art "8278" would be the only article to show up on the page. We need to call roughly 15-20 different headlines, would multiple 'where' tags work?

By gregThomas - June 24, 2016

Hi Osga,

You can update the where statement so that it returns multiple articles at once using the MySQL IN function:

'where' => "`num` IN(1234, 5678, 9012)"

This will return an array of items that have the num values 1234, 5678, 9012.

The other option is to call the getRecord function once for each article.

Thanks,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By osga - June 24, 2016

"The other option is to call the getRecord function once for each article."

where exactly would that be and can you give me an example how it should look?

By Damon - June 24, 2016 - edited: June 24, 2016

The best way to display featured article content is either by date (display the most current) or by another condition (featured content checkbox, etc).

Next, to display article content about a company, next to a company name in a table, there needs to be some reference to that company in the article record. For example, a dropdown with company names. When adding an article record, one would choose the company name that the article refers to in a dropdown list of companies.

With this data, you can use a where statement to show articles that match a company. Next you can filter the articles further to display the latest X number of articles by date or another condition.

Can you explain the number of articles that will appear and what conditions (most recent date or featured) need to met to have to have them appear?

Cheers,
Damon Edis - interactivetools.com

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