sectionList field for category intro and/or image?

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

By matrix - March 14, 2008 - edited: March 14, 2008

I saw a similar question to this posted earlier, but don't think a solution was given yet.

We'd like to have an updateable introduction for each "category" page (list page). This should appear only on the list page, and can be a simple text box, but the only way I know to do this is to the add it to the section list fields. This, of course, means that it will appear as an option on all the pages in the section in the update interface and will surely confuse client's staff.

(Anyhow, I haven't really gotten the field to display on the "sectionList" properly, yet. Can that be done?)

Second way I tried was to add a whole new section called "Intros" just for publishing pared down pages to use as a php include for each intro. This didn't work...error message: "Warning: include() [function.include]: URL file-access is disabled in the server configuration..." Oh, well.

Everything's published as PHP, right? No way to pop up a text file to display in a template?

I am sure there is a more elegant solution to this.

Is there a nice way to do this that I'm missing entirely? Have I succeeded in writing out a totally confusing post?

Whether the answer is yes or no, I appreciate your helping me resolve this quandary.

Thank you.

PS: Apologies for flurries of questions, but deadlines threatening. Yikes.
Happy Interactive Tools product user since 1999

Re: [matrix] sectionList field for category intro and/or image?

By Dave - March 15, 2008

I think you're on the right track with adding a section called "Intros". The include() error you got usually means you can't include files that start with "http://" but you _can_ include files from your server filesystem. You just need to figure out the right path. It might be something like "includes/myfile.ext" or "/www/mysite.com/htdocs/includes/myfile.ext". If you can't figure out the right path let me know and I can help with that.

If you could post a url to a page that shows exactly how you want it to look I could tell you for sure. But I think "Intros" might be the way to go.

>PS: Apologies for flurries of questions, but deadlines threatening. Yikes.

Ask away! We know all about deadlines and want to make sure you hit them too! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] sectionList field for category intro and/or image?

By matrix - March 19, 2008 - edited: March 19, 2008

I surely could use a solution for this and hope you can work your usual miracle and find one.

Here's what I've learned...

Neither the full URL nor the path (as below) works within the include.

I've confirmed that includes like this:
<?php include('introsPage.php?Cottages_Introduction-2/');?>

won't work on the server, whatever the path. I think we need some way to call the information (Cottages_Introduction-2) more directly, not as a php query? Am I even saying that right?

How about something along the lines of:
?php echo file_get_contents ('/path/to/filename.txt'); ?>

My knowledge of php and where this field data content resides are super limited. But it's important that I find a way for clients to update that section introduction. I think a lot of us would use a feature permitting that. Surely do appreciate your help!

Thank you.
Happy Interactive Tools product user since 1999

Re: [matrix] sectionList field for category intro and/or image?

By Dave - March 19, 2008

Hi matrix,

I have an idea but I'm not exactly sure what you're trying to do. If you wanted to email me some links I could take a look and give you my best suggestion.

It sounds, though, like you want an easy way to include the introduction content on a number of different pages without having the PHP code over and over again? Is that right?

Here's one way you can include another page and set the query_string (that's the part of the url after the ?). Basically the include() function just includes filepaths, so we need to set the QUERY_STRING variable. Except if we change it it could break code on the rest of the page, so we need to save it's value and set it back after. Here's the code:

<?
$oldValue = $_SERVER['QUERY_STRING'];

$_SERVER['QUERY_STRING'] = "Cottages_Introduction-2/";
include "introsPage.php";

$_SERVER['QUERY_STRING'] = $oldValue;
?>


I think that will do exactly what you want. Let me know if you need more help with this or if that doesn't do what you need!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] sectionList field for category intro and/or image?

By Kenny - July 29, 2008

I am trying to accomplish somewhat of the same thing.

We have a section called "products" .

Then we have a section called "pricing" that allows you to enter in different sizes of that product and the price. The first field in this section is a list that pulls the name of the product from the "products" section.


I tried to do a php includes in search format that would try to marry up the "pricing" with the "products"

This code:

<?php include("price.php?product=<?php echo $productsRecord['name'] ?>"); ?>

obviously doesn't work, but I am at a loss of what would work.

If we could get this to work without php includes, that would be acceptable too.

In short, I want to pull all "pricing" entries for Metal Garden Sheds and put it on the "product" page for Metal Garden Sheds - all "pricing" entries for Wood Garden Sheds and put it on the "product" page for Wood Garden Sheds - etc....

Re: [sagentic] sectionList field for category intro and/or image?

By Dave - July 30, 2008

What you want to do is have your first viewer that loads the product accept "url searching" like this: products.php?4 That's the default so that should be fine.

For your price viewer you want it to ignore the search values and hard code the search as a where. That's because you want to base the search off the value of the product record, not what's in the url. First add a line to get the escaped productName value

$escapedProductName = mysql_real_escape_string( $productsRecord['name'] );

Next add this in your price viewer code:

'allowSearch' => false,
'where' => " product = '$escapedProductName' ",

And that should do it. Let me know if you get stuck anywhere.
Dave Edis - Senior Developer
interactivetools.com