Here is a patch for revision @123 to get the following URL style:
Code:
http://localhost/site/c2s6-mens-clothing/p4-shirt/product_info.html
PHP Code:
diff includes/init_includes/init_ssu.php /www/site/includes/init_includes/init_ssu.php
31,33c31,32
< $this->cache_folder = DIR_FS_SQL_CACHE."/ssu/";
< $this->extension = SSU_FILE_EXTENSION;
< $this->extension = trim($this->extension);
---
> $this->cache_folder = DIR_FS_SQL_CACHE.'/ssu/';
> $this->extension = '.'.trim(SSU_FILE_EXTENSION);
36c35,37
< $this->mr = trim(($this->catalog_dir=='/' && empty($this->extension)) ? getenv('REQUEST_URI') : preg_replace(array($this->catalog_dir,'/\.'.$this->extension.'/'),'',getenv('REQUEST_URI'), 1),'/ ');
---
> $this->mr = getenv('REQUEST_URI');
> if(substr($this->mr,0,strlen($this->catalog_dir)) == $this->catalog_dir)
> $this->mr = substr($this->mr,strlen($this->catalog_dir));
63,74c64,80
< // first element is always main_page
< // even if this is a "static" page, assigning first element to
< $_GET['main_page'] = $this->mr_parts[0];
< for($i= 1; $i < $this->mr_parts_count; $i++){
< // TODO: a more efficient way to do this?
< if(strstr($this->mr_parts[$i],'c'.SSU_ID_DELIMITER)){
< $cPath = explode(SSU_ID_DELIMITER, $this->mr_parts[$i]);
< $_GET['cPath'] = $cPath[count($cPath)-1];
< }
< elseif(strstr($this->mr_parts[$i],'p'.SSU_ID_DELIMITER)){
< $products_id = explode(SSU_ID_DELIMITER, $this->mr_parts[$i]);
< $_GET['products_id'] = $products_id[count($products_id)-1];
---
> if($debug)
> print_r($this->mr_parts);
> // element with extension is always main_page
> for($i= 0; $i < $this->mr_parts_count; $i++){
> $part = $this->mr_parts[$i];
> // TODO: an more efficient way to do this?
> $part_break = strpos($part,SSU_ID_DELIMITER);
> if($part_break>0){
> // Use cache to validate structure
> $file_name = substr($part,0,$part_break);
> if(file_get_contents($this->cache_folder.$file_name) != substr($part,$part_break)){
> if ($file_name[0] == 'c')
> $_GET['cPath'] = str_replace('s','_',substr($file_name,1));
> elseif ($file_name[0] == 'p')
> $_GET['products_id'] = substr($file_name,1);
> continue;
> }
75a82,84
> if(substr($part,strlen($part)-strlen($this->extension )) == $this->extension ){
> $_GET['main_page'] = substr($part,0,strlen($part)-strlen($this->extension ));
> }
77c86
< $_GET[$this->mr_parts[$i]] = $this->mr_parts[($i + 1)];
---
> $_GET[$part] = $this->mr_parts[($i + 1)];
81c90
< $_GET[$this->mr_parts[$i]] = '';
---
> $_GET[$part] = '';
111,113c120
< $link = HTTP_SERVER;
< if ($connection == 'SSL' && ENABLE_SSL == 'true')
< $link = HTTPS_SERVER ;
---
> $link = ($connection == 'SSL' && ENABLE_SSL == 'true') ? HTTPS_SERVER : HTTP_SERVER;
116,122c123,124
< if ($use_dir_ws_catalog) {
< if ($connection == 'SSL' && ENABLE_SSL == 'true') {
< $link .= DIR_WS_HTTPS_CATALOG;
< } else {
< $link .= DIR_WS_CATALOG;
< }
< }
---
> if ($use_dir_ws_catalog)
> $link .= ($connection == 'SSL' && ENABLE_SSL == 'true') ? DIR_WS_HTTPS_CATALOG : DIR_WS_CATALOG;
171,182c173,180
< // Any param? No? return page.extension
< if(empty($parameters)){
< if(empty($sid))
< return $link.$page.(trim(SSU_FILE_EXTENSION)=='' ? '' : '.'.SSU_FILE_EXTENSION);
< else
< return $link.$page.'/'.$sid;
< }
<
< $parameters = zen_output_string($parameters);
< $link .= $page.'/'.$parameters;
<
< while (substr($link, -1) == '/') $link = substr($link, 0, -1);
---
> // Any param?
> if(!empty($parameters)){
> $parameters = zen_output_string($parameters);
> $link .= $parameters.'/';
> }
>
> // return page.extension
> $link .= $page.((trim(SSU_FILE_EXTENSION)=='') ? '' : '.'.trim(SSU_FILE_EXTENSION));
200c198
< return 'c'.SSU_ID_DELIMITER.$content.SSU_ID_DELIMITER.$cPath;
---
> return $file_name.SSU_ID_DELIMITER.$content;
225c223
< return "c$cPath";
---
> return 'c'. str_replace('_','s',$cPath);
227c225
<
---
>
234c232
< return 'p'.SSU_ID_DELIMITER.$content.SSU_ID_DELIMITER.$products_id;
---
> return $file_name.SSU_ID_DELIMITER.$content;
Bookmarks