Field Editor
24 posts by 2 authors in: Forums > CMS Builder
Last Post: December 27, 2007 (RSS)
By Dave - December 26, 2007
interactivetools.com
Re: [Dave] Field Editor
By Djulia - December 26, 2007
$numFromUrl = getNumberFromEndOfUrl();
if (!$numFromUrl) { $numFromUrl = 5; }
1) Your solution functions.
But that answers partly the problem.
If Virginia delete recording 5, Jack must again edit file blogPage.php to modify the value of $numFromUrl.
It would be possible to use, for example, order ASC ?
Thus, the value would be the first recording found in the table.
2) If I delete the second block, I always have the same problem.
In fact in this case, it is the value of "$options['orderBy'] = 'ordre DESC, date DESC, title';" which is used.
Djulia
P.s. : Thank you for your patience.
By Dave - December 26, 2007
require_once "/xxx/viewer_functions.php";
// load menu items
$options = array();
$options['tableName'] = 'blog';
$options['titleField'] = 'title';
$options['viewerUrl'] = '/xxx/blogPage.php';
$options['perPage'] = '9999';
$options['orderBy'] = 'order DESC, date DESC, title';
$options['pageNum'] = '1';
$options['where'] = '';
$options['useSeoUrls'] = '1';
list($listRows, $listDetails) = getListRows($options);
// get record num for page content
$numFromUrl = getNumberFromEndOfUrl();
if (!$numFromUrl) {
$lastIndex = count($listRows) - 1;
$numFromUrl = $listRows[$lastIndex]['num']; // use default
}
// load page content
$options = array();
$options['tableName'] = 'blog';
$options['recordNum'] = $numFromUrl;
$options['where'] = '';
$record = getRecord($options);
It loads the list of record for your menu options as $listRows. And since those are already sorted by 'order DESC' (opposite of what you want) we just get the last one as the record number to use if no record number is specified in the url.
Let me know if that works the way you want. :)
interactivetools.com
Re: [Dave] Field Editor
By Djulia - December 26, 2007
Page Viewer (blog) errors
Unknown option 'titleField' specified. Valid option names are: (tableName, recordNum, where)
Unknown option 'viewerUrl' specified. Valid option names are: (tableName, recordNum, where)
Unknown option 'perPage' specified. Valid option names are: (tableName, recordNum, where)
Unknown option 'orderBy' specified. Valid option names are: (tableName, recordNum, where)
Unknown option 'pageNum' specified. Valid option names are: (tableName, recordNum, where)
Unknown option 'useSeoUrls' specified. Valid option names are: (tableName, recordNum, where)
You have an idea ?
Thank you for your assistance.
Djulia
By Dave - December 26, 2007
require_once "/xxx/viewer_functions.php";
// load menu items
$listOptions = array();
$listOptions['tableName'] = 'blog';
$listOptions['titleField'] = 'title';
$listOptions['viewerUrl'] = '/xxx/blogPage.php';
$listOptions['perPage'] = '9999';
$listOptions['orderBy'] = 'order DESC, date DESC, title';
$listOptions['pageNum'] = '1';
$listOptions['where'] = '';
$listOptions['useSeoUrls'] = '1';
list($listRows, $listDetails) = getListRows($listOptions);
// get record num for page content
$numFromUrl = getNumberFromEndOfUrl();
if (!$numFromUrl) {
$lastIndex = count($listRows) - 1;
$numFromUrl = $listRows[$lastIndex]['num']; // use default
}
// load page content
$pageOptions = array();
$pageOptions['tableName'] = 'blog';
$pageOptions['recordNum'] = $numFromUrl;
$pageOptions['where'] = '';
$record = getRecord($pageOptions);
interactivetools.com
Re: [Dave] Field Editor
By Djulia - December 26, 2007
But, maintaining all the pages have the same recording.
In fact, they take the value of :
$listOptions['orderBy'] = 'order DESC, date DESC, title';
2 if 'order ASC' or 5 if 'order DESC'.
It is possible to correct this problem ?
Thank you,
Djulia
By Dave - December 26, 2007
It should be that the menu shows all the available pages and that the following urls display as follows:
blogPage.php (shows last page listed on menu, whatever the number)
blogPage.php/5 (shows record 5 - Home)
blogPage.php/4 (shows record 4 - Page1)
blogPage.php/3 (shows record 3 - Page2)
blogPage.php/2 (shows record 2 - Contact Us)
If that's not happening perhaps you can attach the blogPage.php again and I'll have a look.
interactivetools.com
Re: [Dave] Field Editor
By Djulia - December 26, 2007
<ul id="menu">
<?php $numFromUrl = getNumberFromEndOfUrl(); foreach ($listRows as $record): if ($record): ?>
<?php if ($record['num'] == $numFromUrl): ?>
<li><span id="menuselected"><?php echo $record['title'] ?></span></li>
<?php elseif ($numFromUrl == ""): ?>
<li><span id="menuselected"><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></span></li>
<?php else: ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></li>
<?php endif ?>
<?php endif ?>
<?php endforeach ?>
</ul>
It seems that there is a conflict with the menu and the data of the recording.
Your opinion ?
Djulia
Re: [Dave] Field Editor
By Djulia - December 26, 2007
Yes
Here 2 files :
1 == blogPage-error.php
2 == blogPage-no-error.php
Djulia
By Dave - December 26, 2007
I got an error on my MySQL server (maybe not on yours) because 'order' was a reserved word. So I quoted it like this:
$listOptions['orderBy'] = '`order` ASC, date DESC, title';
The code that displays the menu also uses the $record variable. This overwrites the $record variable we define at the top of the script, so if we change it to something else like $listRecord, it works as intended.
<?php foreach ($listRows as $listRecord): if ($listRecord): ?>
... change all $record variables to $listRecord ...
<?php endif ?>
<?php endforeach ?>
Hope that helps!
interactivetools.com