 | |  |
 | |  |
 |

Dave
Staff
/ Moderator

May 29, 2008, 9:06 AM
Post #2 of 7
(283 views)
Shortcut
|
|
Re: [Toledoh] Simple? php include?
[In reply to]
|
Can't Post
|
|
Hi Tim, PHP include() usually works with filepaths not urls. So you can't have the ?query-string on the end or it won't work. There's a few different ways to do what you want though. One way is just to include the viewer code directly like this with a "where" to tell it which record number to grab:
<?php list($myRecords, $myMetaData) = getRecords(array( 'tableName' => 'myTableName', 'where' => "num = '4'" )); $myRecord = @$myRecords[0]; // get first record ?> <?php echo $myRecord['title']; ?> Or if you wanted to keep your code really clean you could put that snippet in a different file (don't forget the "require once" line that goes at the top). You could also create a field called 'category' and then test for that by value instead of the number. That will make the code more readable. So it would load the sidebar text with the category 'about us':
... 'where' => "category = 'about us'" ... Hope that makes sense. Let me know if you need more details or help! :) Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 |

Toledoh
User
May 29, 2008, 9:20 AM
Post #3 of 7
(282 views)
Shortcut
|
|
Re: [Dave] Simple? php include?
[In reply to]
|
Can't Post
|
|
Thanks for the quick reply! but... sorry - it's just after 2am here... I'm not thinking that fast... <?php list($myRecords, $myMetaData) = getRecords(array( 'tableName' => 'cms_text', 'where' => "num = '4'" )); $myRecord = @$myRecords[0]; // get first record ?> <?php echo $myRecord['description']; ?> still get an error... http://fabmosphere.com.tmp.anchor.net.au/casestudies_index.php Tim Forrest Toledoh Enterprises
|
|
|  |
 |

Dave
Staff
/ Moderator

May 29, 2008, 9:54 AM
Post #4 of 7
(276 views)
Shortcut
|
|
Re: [Toledoh] Simple? php include?
[In reply to]
|
Can't Post
|
|
Hi Tim, Sorry, make sure you have the require_once line in there (or at the top of the page):
<?php require_once "/your/path/here/lib/viewer_functions.php"; Let me know if that fixed it. Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 |

Toledoh
User
May 29, 2008, 3:32 PM
Post #5 of 7
(259 views)
Shortcut
|
|
Re: [Dave] Simple? php include?
[In reply to]
|
Can't Post
|
|
Mmmm... I have the code already at the top of the page... <?php require_once "/home/fabmos/public_html/cmsAdmin/lib/viewer_functions.php"; $caseOptions = array(); // NOTE: see online documentation for more details on these options $caseOptions['tableName'] = 'case'; // (REQUIRED) MySQL tablename to list record from. Example: 'article'; $caseOptions['titleField'] = ''; // (optional) MySQL fieldname used in viewer url for search engines. Example: 'title' would display: viewer.php/article_title_here-123 $caseOptions['viewerUrl'] = 'casePage.php'; // (optional) URL of viewer page. Example: '/articles/view.php'; $caseOptions['perPage'] = ''; // (optional) The number of records to display per page. Example: '5'; Defaults to 10. $caseOptions['orderBy'] = 'name'; // (optional) Fieldnames to sort by. Example: 'field1, field2 DESC, field3'; $caseOptions['pageNum'] = ''; // (optional) Page number of results to display. Example: '1'; Defaults to ?page=# value, or 1 if undefined $caseOptions['where'] = ''; // (ADVANCED) Additional MySQL WHERE conditions. Example: 'fieldname = "value"' $caseOptions['useSeoUrls'] = ''; // (ADVANCED) Set this to '1' for search engine friendly urls: view.php/123 instead of view.php?123 (not supported on all web servers) list($caseRecordList, $caseListDetails) = getListRows($caseOptions); ?> I placed this here for calling content from another table... is this the issue, that I'm trying to get content from 2 areas onto one page? Cheers, Tim Tim Forrest Toledoh Enterprises
|
|
|  |
 |

Toledoh
User
May 29, 2008, 3:40 PM
Post #6 of 7
(258 views)
Shortcut
|
|
Re: [Toledoh] Simple? php include?
[In reply to]
|
Can't Post
|
|
Duh - sorry to waste your time. as soon as I submitted the last message I realised the problem... for every table you need to add the "step 1" stuff... Got it! Thanks! Tim Forrest Toledoh Enterprises
|
|
|  |
 |

Dave
Staff
/ Moderator

May 29, 2008, 4:14 PM
Post #7 of 7
(255 views)
Shortcut
|
|
Re: [Toledoh] Simple? php include?
[In reply to]
|
Can't Post
|
|
Glad to hear it's working! :) Dave Edis - Senior Developer interactivetools.com
|
|
|  |
|