What's the best way to achieve this please?

7 posts by 2 authors in: Forums > CMS Builder
Last Post: July 8, 2014   (RSS)

By willydoit - July 3, 2014

I have a section on a website which displays a selection of books by local authors, at present the cmsb section "Literary_corner" is made up of  a record for each book. 

The listing page is called literary_list.php. At present the listing page just shows an overview of each book with a link to a detail page for that book (literary_detail.php). what I would like to do is have an "About the author " link on the books detail page to a page where we provide a biography about the author with a listing and synopsis of all the books by that author in the same format as we have  already have on literary_list.php.

I was initially going to have "about the author" fields within the book record, however I soon realised that that would require authors with multiple books to have to enter this information on each book record which wasn't ideal so I am now thinking that it needs another section called "authors" with just the biography information in it with a record for each record. Having no experience in the design or implementation of databases or php this seems to be the logical setup but am concerned that we are separating this information into two separate sections when logic suggests that in reality it is one section but split into two subsections. So to start with advice on the basic framework I should be employing before I get to far down the wrong path would be appreciated.

If setting up two sections is the correct way to go then that is simple enough but then comes the question of how I create my page so that it shows the authors details taken from the author section followed by a list of their books taken from the section which contains all the books.

I am concerned that because I don't have the experience with cmsb that if I don't configure the sections in the right way I am going to make life ever increasingly difficult for myself when trying to get all the required data onto a single page.

I am assuming that what I want to achieve is well within the capabilities of cmsb but some basic assistance on how the best way to achieve the facility to have information on an author and all the books they have written and be able to present all that on a single page with the authors only having to enter biography info once and add new books when published would be appreciated. 

 I know I could stump up the money to get you to do this for me, but to be honest I have been using CMSB on different sites for years and I need to be able to get a better understanding of the basics so I can sort these things out for myself, I have looked through the forums, and have purchased the cmsb cookbook, but to be honest, perhaps its old age creeping in but I find that they all assume a basic level of knowledge that many of us just dont possess. I feel like I have bought myself a great car but have to employ someone else to drive it cos I cannot drive :-(

Thanks in advance for any help provided.

By willydoit - July 3, 2014

Hi Claire,

Due to the time difference am not in the office at the moment but just had to take the time to say Thank you very much, that info is exactly what I was looking for but didnt dare hope to get such a complete answer.

I will run through everything tomorrow but it looks exactly what I was wanting. Not only will it solve this problem but I can already see it opening doors to so many other possibilities.

Thanks again for all your help.

By claire - July 3, 2014

No problem - let me know if you run into any issues.

--------------------

Claire Ryan
interactivetools.com

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

By willydoit - July 4, 2014

Hi Claire,

I had a couple of issues which basically took me about 4 hours to diagnose which was down to my lack of knowledge more than anything elese but they were resolved by simply changing 

 'where' => 'author = ' . mysql_escape($authorRecord['num']),

to 

'where' => 'author_id = ' . mysql_escape($authorsRecord['num']),

but 4 hours or not I was pleased that I had managed to eventually track the issue down and I generated a better understanding of things in the process.

Thanks for all your help.

By claire - July 4, 2014

No problem. Those variable names are probably the only thing you'll need to watch out for.

If you want to get to grips with more of this in depth, check out the PHP tutorial on W3CSchools: http://www.w3schools.com/PHP/

Take a look at for loops, arrays and the if/else stuff. Everything in the basic section is probably worth reading but those are what you'll use more than anything else. Also take a look at the PHP alternative syntax (just another way of running loops etc, which is easier to read when it's mixed up in HTML): http://www.php.net/manual/en/control-structures.alternative-syntax.php CMSBuilder uses this syntax in the Code Generator, so it's good to understand it.

--------------------

Claire Ryan
interactivetools.com

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

By willydoit - July 8, 2014

Hi Claire,

Thanks for that, they will be a great source of reference and will probably save hours of head scratching :-)