New to CMS Builder and need a little help please

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

By watersidedesign - July 4, 2008

Hi All,

This is my first time using CMSB and PHP for that matter so I wonder if you could offer a little assistance :)

I have used CMSB to create a php file that lists categories. When uploaded to the server this works fine. What I want to do is include this in different files so what I thought I could do was simply use include instead of copying the code into each page.

So for example:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17%">&nbsp;</td>
<td width="83%">&nbsp;</td>
</tr>
<tr>
<td><?php include("/panels/maincat.php"); ?></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>




but all this does is shows a blank page where if i call /panels/maincat.php from the browser, i get my list of categories.



Any ideas?

Re: [watersidedesign] New to CMS Builder and need a little help please

By Donna - July 4, 2008

Hi there!

PHP actually requires the full server path if you're doing an include. So, /panels/maincat.php likely isn't the right path. It'll probably be something more like /home/username/httpdocs/panels/maincat.php -- check with your hosting provider, and they can tell you the full path to your document root. :)
Donna

--
support@interactivetools.com

Re: [watersidedesign] New to CMS Builder and need a little help please

By Dave - July 4, 2008

Or try a relative path that doesn't start with a slash, like this:

include("panels/maincat.php");

If it start with a slash you need the entire filepath.

Let me know if removing the first / fixed it or not.
Dave Edis - Senior Developer
interactivetools.com