Omit page filename omits folder.
Submitted Marcher Technologies, May 06 2012 03:03 AM | Last updated May 06 2012 03:03 AM
took a sharp eye and some debug to find/figure this.
If one Omits the Page file-name from a file in a folder, when visiting that page 2 things occur, 1 expected:
A:(expected Behaviour)ipsRegistry::getClass('ccsFunctions')->getPageName() is empty
B:(undesired behaviour, bug)ipsRegistry::getClass('ccsFunctions')->getFolder() is empty.
This makes it programatically difficult or impossible to tell the difference between
If one Omits the Page file-name from a file in a folder, when visiting that page 2 things occur, 1 expected:
A:(expected Behaviour)ipsRegistry::getClass('ccsFunctions')->getPageName() is empty
B:(undesired behaviour, bug)ipsRegistry::getClass('ccsFunctions')->getFolder() is empty.
This makes it programatically difficult or impossible to tell the difference between
http://mysite.com/and
http://mysite.com/folder/
| Status: | Fixed |
| Version: | 2.3.1 |
| Fixed In: | 2.3.2 |











6 Comments
getPageName returns the folder in this situation, but without the preceding / on the directory.... its acting as if i made a page with the file-name of the folder, not like I made a folder and put an index file within it.
problem is here, line ~630 at ccsFunctions->_getPageAndFolder:
$uriBits = explode( '/', $_path ); $myFolder = ''; if( count($uriBits) > 1 ) { $page = array_pop($uriBits); // Retrieve the file name $myFolder = count($uriBits) ? '/' . implode( '/', $uriBits ) : ''; $myFolder = ( $myFolder == '/' ) ? '' : $myFolder; } else { $page = $_path; } $folder = $myFolder;$r['page_folder'].$r['page_seo_name']!=$this->registry->getClass('ccsFunctions')->getFolder().$this->registry->getClass('ccsFunctions')->getPageName()and without the / on the page name that should be a folder, no amount of fiddling from my end will make it work correctly across all index pages.Make an index page in a folder... omit file-name, raw PHP page... contents:
print $this->registry->ccsFunctions->returnPageUrl( array('page_seo_name' => $this->registry->ccsFunctions->getPageName(), 'page_folder' => $this->registry->ccsFunctions->getFolder(), 'page_id' => '0' )); print '<br />Page: '; print $this->registry->ccsFunctions->getPageName(); print '<br />Folder: '; print $this->registry->ccsFunctions->getFolder();the URL Generated is Slightly wrong as well... likely because of the page is folder issue.I've added methods so you can override the automatically sniffed data.
/** * Programatically set folder * * @param string Folder to set * @return @e void * @link http://community.invisionpower.com/tracker/issue-37244-omit-page-filename-omits-folder/ * @note IP.Content does not use this method, it is here only for developers facing issues due to the bug report linked */ public function setFolder( $folder='' ) { $this->folder = $folder; } /** * Programatically set page * * @param string Page to set * @return @e void * @link http://community.invisionpower.com/tracker/issue-37244-omit-page-filename-omits-folder/ * @note IP.Content does not use this method, it is here only for developers facing issues due to the bug report linked */ public function setPage( $page='' ) { $this->page = $page; }