| View previous topic :: View next topic |
| Author |
Message |
synfield
Joined: 13 Dec 2007 Posts: 5
|
Posted: Thu Dec 13, 2007 10:28 pm Post subject: Datagrid pager links url appending problem |
|
|
The following code correctly renders an html table, of a mysql database table, with paging. Im using php 5.2.4 on winxp, IIS 5.1.
However the page links show the following format, and although I can still navigate to other pages, all my image urls and my includes in my html code get their urls appended so they lose their file path reference.
e.g. my page links urls currently display
http://localhost/services/village/test_datagrid_datasource.php/services/village/test_datagrid_datasource.php?page=3
should be;
http://localhost/services/village/test_datagrid_datasource.php?page=3
How do I prevent this, is there an option setting for this?
Code snippet as follows;
$options = array('dsn' => 'mysql://username:password@localhost/villapp');
$test = $datagrid->bind($sql,$options);
// Print binding error if any
if (PEAR::isError($test)) {
echo $test->getMessage();
}
/* Get a reference to the Renderer object */
$renderer =& $datagrid->getRenderer();
/* For the <table> element : */
$renderer->setTableAttribute("class", "studvill");
$renderer->setTableAttribute("cellpadding", "0");
$renderer->setTableAttribute("cellspacing", "0");
$renderer->setTableAttribute("width", "95%");
/* For every odd <tr> elements */
$renderer->setTableOddRowAttributes(array ("class" => "odd"));
/* Get and output HTML links */
$pagingHtml = $renderer->getPaging();
echo "<p class=\"paging\">Pages : $pagingHtml</p>";
// Define columns
$datagrid->addColumn(new Structures_DataGrid_Column("Photo ID", null, null, array('width' => '130px'), null, 'printPhotoID()'));
$datagrid->addColumn(new Structures_DataGrid_Column('Student ID', 'studentid', 'studentid', array('width' => '80px')));
$datagrid->addColumn(new Structures_DataGrid_Column('Name', 'sname', 'sname', array('width' => '80px'), null, 'printFullName()'));
etc...........
// Print the DataGrid with the default renderer (HTML Table)
$test = $datagrid->render(); |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1048
|
Posted: Thu Dec 13, 2007 11:42 pm Post subject: |
|
|
That's either a problem with your server or a bug in the Pager package.
Pager uses IIRC $_SERVER['PHP_SELF'] to determine the URLs. Can you please the contents of this variable? And you should also make sure that you have the latest version of Pager installed. |
|
| Back to top |
|
 |
synfield
Joined: 13 Dec 2007 Posts: 5
|
Posted: Fri Dec 14, 2007 3:54 am Post subject: |
|
|
Thanks Mark, for your reply.
This isn't a PEAR problem. It only occurs on IIS php cgi installs.
I the links display correctly if php is installed as an ISAPI module in IIS.
I have tried setting the cgi.fix_pathinfo=1 in php.ini, but this has no effect.
Hope somebody can help.
Cheers. |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1048
|
Posted: Fri Dec 14, 2007 4:17 pm Post subject: |
|
|
| synfield wrote: | This isn't a PEAR problem. It only occurs on IIS php cgi installs.
I the links display correctly if php is installed as an ISAPI module in IIS.
I have tried setting the cgi.fix_pathinfo=1 in php.ini, but this has no effect. |
Did you restart your server after the change? |
|
| Back to top |
|
 |
synfield
Joined: 13 Dec 2007 Posts: 5
|
Posted: Sat Dec 15, 2007 1:34 pm Post subject: |
|
|
The problem relates to fast cgi php 5.2.4 install on win xp sp2.
It appears that the $_SERVER['PHP_SELF'] is the culprit!
as it outputs "/dir1/dir2/my_script.php/dir1/dir2/my_script.php"??
Therefore I've had to insert this nasty hack into "C:\php5\PEAR\Structures\DataGrid\Renderer\HTMLTable.php"
$path_parts = pathinfo($_SERVER['PATH_INFO']);
(strstr( PHP_OS, "WIN") && strstr( PHP_SAPI, "cgi-fcgi"))? $_SERVER['PHP_SELF'] = $path_parts['dirname']."/".$path_parts['filename'].".".$path_parts['extension'] : $_SERVER['PHP_SELF'];
If anyone can point me in the right direction then I'm all ears.
I was hoping that it would be a php.ini or IIS5.1 config tweak.
Cheers. |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1048
|
Posted: Sat Dec 15, 2007 2:34 pm Post subject: |
|
|
| synfield wrote: | The problem relates to fast cgi php 5.2.4 install on win xp sp2.
It appears that the $_SERVER['PHP_SELF'] is the culprit! |
Well, if you have restarted your server after the change in the right (!) php.ini file, it's the best idea to write a bug report.
| synfield wrote: | | Therefore I've had to insert this nasty hack into "C:\php5\PEAR\Structures\DataGrid\Renderer\HTMLTable.php" |
That might be a quick fix, but it's not the best solution for the future. Let the bug get fixed, and your code will work without this hack in a file that you shouldn't edit (<= you'll lose your changes if you update the HTML_Table driver of SDG). |
|
| Back to top |
|
 |
synfield
Joined: 13 Dec 2007 Posts: 5
|
Posted: Sat Dec 15, 2007 11:00 pm Post subject: |
|
|
Mark, I have rebooted the server a number of times.
Wasn't sure about logging a bug report for this as it isn't a PEAR issue.
Maybe I should log it as a PHP 5.2.4 fastcgi win xp install bug??
What do you reckon?
Regards
Synfield |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1048
|
Posted: Sun Dec 16, 2007 2:19 pm Post subject: |
|
|
| synfield wrote: |
Wasn't sure about logging a bug report for this as it isn't a PEAR issue. |
Right, the PEAR bug tracker would have been the wrong place.
| synfield wrote: | | Maybe I should log it as a PHP 5.2.4 fastcgi win xp install bug?? |
Yes, use the bug tracker on www.php.net to report this issue. |
|
| Back to top |
|
 |
synfield
Joined: 13 Dec 2007 Posts: 5
|
Posted: Mon Dec 17, 2007 1:54 am Post subject: |
|
|
Submitted a php bug report today. Will advise this thread of outcome in due course.
Thanks |
|
| Back to top |
|
 |
|