PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Datagrid pager links url appending problem

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures
View previous topic :: View next topic  
Author Message
synfield



Joined: 13 Dec 2007
Posts: 5

PostPosted: Thu Dec 13, 2007 10:28 pm    Post subject: Datagrid pager links url appending problem Reply with quote

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
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1053

PostPosted: Thu Dec 13, 2007 11:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
synfield



Joined: 13 Dec 2007
Posts: 5

PostPosted: Fri Dec 14, 2007 3:54 am    Post subject: Reply with quote

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
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1053

PostPosted: Fri Dec 14, 2007 4:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
synfield



Joined: 13 Dec 2007
Posts: 5

PostPosted: Sat Dec 15, 2007 1:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1053

PostPosted: Sat Dec 15, 2007 2:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
synfield



Joined: 13 Dec 2007
Posts: 5

PostPosted: Sat Dec 15, 2007 11:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1053

PostPosted: Sun Dec 16, 2007 2:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
synfield



Joined: 13 Dec 2007
Posts: 5

PostPosted: Mon Dec 17, 2007 1:54 am    Post subject: Reply with quote

Submitted a php bug report today. Will advise this thread of outcome in due course.

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software