Need help with simple task

7 posts by 3 authors in: Forums > CMS Builder
Last Post: November 22, 2008   (RSS)

Hi, I think what I want to do is very simple, but I can't figure it out.

I have some text with links in it and I want to to appear on each of my pages on my website. But I only ever want to edit one copy of this seciton of text and links and it will automatically change on each of my websites.

Basically how do I store this section of HTML in CMS Builder properly (Single Menu Editor Type?). (I think I have this part created)

More importantly how do I write code to 'grab' this section of HTML and display it on a particular webpage?

Re: [ineedhelp] Need help with simple task

Hi,
A common way is to use php includes. You create a text file with your links, upload that to your server. Wherever you want the links to appear you use php include code to pull the links in. To change the links you simply edit the text file.

There are lots of references, search for "php+include" or visit here http://www.w3schools.com/php/php_includes.asp

HTH,
Mickey

Re: [Michael Blake] Need help with simple task

Yes, I realize php includes do exactly what I want. But my question was how do I do that using the CMS builder. I want the client to be able to use the CMS builder interface to make changes to the body content that I'm looking to add, not to have to edit some text file.

Re: [aev] Need help with simple task

I guess what I'm saying is that the code that is provided:

<h1>leftnav - Detail Page Viewer</h1>
Record Number: <?php echo $leftnavRecord['num'] ?><br/>
Title: <?php echo $leftnavRecord['title'] ?><br/>
Content: <?php echo $leftnavRecord['content'] ?><br/>
_link : <a href="<?php echo $leftnavRecord['_link'] ?>"><?php echo $leftnavRecord['_link'] ?></a><br/>
<hr/>
<?php if (!$leftnavRecord): ?>
No record found!<br/><br/>
<?php endif ?>


Does not work when I have it in my page. It is not retrieving the code which I have put into the single record.

Re: [ineedhelp] Need help with simple task

Wow!, At the very least you could have replied politely, I was trying to help you. Had you been polite I'd have given you the answer, now you can wait for someone else.

Mickey

Re: [Michael Blake] Need help with simple task

By ineedhelp - November 22, 2008 - edited: November 22, 2008

Thanks Mike. I already figured it out anyway. For those who want to know what I did:

list($headerRecords, $headerMetaData) = getRecords(array(
'tableName' => 'header',
));
$headerRecord = @$headerRecords[0]; // get first record

Goes in the top part of your page (which is what the generator gives you)

And,

<?php echo $headerRecord['content'] ?>

Will put the content info into the page. The generator doesn't use the word 'content' so it wasn't working for me by default. Hope this helps anyone who has the same problem. Cheers.