Welcome, Guest. Please login or register.
Did you miss your activation email?

 
Advanced search

22734 Posts in 6698 Topics- by 17594 Members - Latest Member: permsk

21-07-2019 18:12:03
JOOM::GALLERY::FORUMArchiveJoomGallery 1.5 MVC - ExtensionsAddonsrouter.php for joomgallery
Pages: [1] 2 3 ... 5
Print
Author Topic: router.php for joomgallery  (Read 66821 times)
0 Members and 1 Guest are viewing this topic.
BrOncO
Newbie
*
Offline Offline

Posts: 19



View Profile WWW
« on: 18-06-2009 16:54:25 »

hello all;

I made a file router.php for joomgallery, is a file conversion from the sef_ext.php file for sef advance.
For my is best use router.php instead sef_ext.php, if a url is not traslate in the router.php the page works equally.
tested with sef advance and standard joomla sef url and php5.

   
in the first part of the file you can change some parameters of the url (language and force itemid):
Code:
   // force the router to use only this Itemid, example: 35
   //default: false
   $rparams['force_itemid'] = false;
   
   //language params
   $rparams['lastcomment'] = 'last commented pictures';
   $rparams['lastadd'] = 'last added pictures';
   $rparams['rating'] = 'best rated pictures';
   $rparams['hits'] = 'most viewed pictures';
   $rparams['userpanel'] = 'control_panel';
   
   $rparams['page'] = 'page'; //gallery and category pagination
   $rparams['space'] = '-'; //replace space in the url !!( do not use symbols that are in the categories name )!!
   
   
   $rparams['idbefore'] = true; //set false for make the id image after the name title 
   //false = joomgallery/catname/imagename-idimage
   //true  = joomgallery/catname/idimage-imagename
   
   
   //for not use the image id in the link, not use this in a multiuser gallery!!
   $rparams['noidintitle'] = false; //set true for not use the id in the image title
   //is not possible use $rparams['space'] symbols in the imagename
   //no 2 images can ave the same title in the same category!!!  is not possible replace special charset in the imagename

the url is same as this whit the sef_ext.php:

category: domain.com/images/categoryname/subcategory.html
image: domain.com/images/category/subcategory/idimage-imagetitle.html

the /images/ part is set by joomla, using the Itemid for find the menulink name

For the new file router.php go in this post http://www.forum.en.joomgallery.net/index.php?topic=1464.msg6699#msg6699
« Last Edit: 08-11-2009 00:25:32 by BrOncO » Logged

Sorry for my bad english!!!
Buy Slurm :D
aHa
Developer-Team
Hero Member
*****
Offline Offline

Posts: 990


View Profile WWW
« Reply #1 on: 18-06-2009 20:22:20 »

Hi,
thank you very much.
I will test it on my SEFAdvance installation.

What are the disadvantages of our sef_ext.php in relation to your solution?

Regards
Andreas
Logged
BrOncO
Newbie
*
Offline Offline

Posts: 19



View Profile WWW
« Reply #2 on: 18-06-2009 23:13:00 »

hi aHa,

The advantage with the router.php is that if a url is not translate in the router.php the page/link works equally, with sef_ext.php if a url is not translate does not work.

example:

with this sef_ext.php  http://www.en.joomgallery.net/downloads/view-document-details/76-sefadvance-extension-v-1.5.html

the pagination in the control_panel does not work, the url for all page is the same
domain.com/images/control_panel.html
In this case is necessary to update the file sef_ext.php

whit the router.php the url for the pagination is not coded, but all work, joomla add the variable at the end of sef url
domain.com/images/control_panel.html?start=40

if in the future joomgallery adds new url does not need to update the file router.php.

       
a disadvantages is that the router.php use the name of menu link for set the first part of the url domain.com/images/control_panel.html, is not possible set the name in the Sef Advance params.
The name is found with the Itemid, if the Itemid is not set the url is domain.com/component/joomgallery/control_panel.html (for this i ave added the $force_itemid param).


« Last Edit: 18-06-2009 23:15:39 by BrOncO » Logged

Sorry for my bad english!!!
Buy Slurm :D
josetes
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #3 on: 23-07-2009 12:56:05 »

Upload sef_ext and router to directory "components/com_joomgallery" and result this error

// force the router to use only this Itemid, example: 35 //default: false $rparams['force_itemid'] = false; //language params $rparams['lastcomment'] = 'last commented pictures'; $rparams['lastadd'] = 'last added pictures'; $rparams['rating'] = 'best rated pictures'; $rparams['hits'] = 'most viewed pictures'; $rparams['userpanel'] = 'control_panel'; $rparams['page'] = 'page'; //gallery and category pagination $rparams['space'] = '-'; //replace space in the url !!( do not use symbols that are in the categories name )!!
Fatal error: Call to undefined function joomgalleryBuildRoute() in /home/xxxxx/xxxxxxx.com/includes/router.php on line 309

Thanks
Logged
josetes
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #4 on: 23-07-2009 13:39:02 »

Upload sef_ext and router to directory "components/com_joomgallery" and result this error

// force the router to use only this Itemid, example: 35 //default: false $rparams['force_itemid'] = false; //language params $rparams['lastcomment'] = 'last commented pictures'; $rparams['lastadd'] = 'last added pictures'; $rparams['rating'] = 'best rated pictures'; $rparams['hits'] = 'most viewed pictures'; $rparams['userpanel'] = 'control_panel'; $rparams['page'] = 'page'; //gallery and category pagination $rparams['space'] = '-'; //replace space in the url !!( do not use symbols that are in the categories name )!!
Fatal error: Call to undefined function joomgalleryBuildRoute() in /home/xxxxx/xxxxxxx.com/includes/router.php on line 309

Thanks

Solved, download archive router.php
Thanks!!! Grin Grin Grin Grin
Logged
marty
Newbie
*
Offline Offline

Posts: 3


View Profile
« Reply #5 on: 05-08-2009 13:29:35 »

Solved, download archive router.php
Thanks!!! Grin Grin Grin Grin

I was still confused... until I registered to ask how you fixed it...  Grin

Only registered logged in users can see the file attached to BrOncO's original message, which is what you need to download.

Works great - thanks BrOncO.
Logged
jaymz
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #6 on: 07-08-2009 05:28:06 »

I placed the router.php file in the right directory and still receive a blank page when the menu for joomgallery is clicked. You can see it here:

http://development.texas-hunting.org/media/

Menu is called "media" from here: http://development.texas-hunting.org/
Logged
BrOncO
Newbie
*
Offline Offline

Posts: 19



View Profile WWW
« Reply #7 on: 09-08-2009 10:42:36 »

I placed the router.php file in the right directory and still receive a blank page when the menu for joomgallery is clicked. You can see it here:

http://development.texas-hunting.org/media/

Menu is called "media" from here: http://development.texas-hunting.org/
no sure for this, but a folder "media" exist in the joomla folder, i think that this blank page is the joomlafolder\media\index.html file.

try changing the link name in the joomla menu. example media-->multimedia


Quote
I was still confused... until I registered to ask how you fixed it...  Grin

Only registered logged in users can see the file attached to BrOncO's original message, which is what you need to download.

Works great - thanks BrOncO.

Lol i edit the 1° message for make the link visible to guest user, I hope there are no problems
« Last Edit: 09-08-2009 10:45:39 by BrOncO » Logged

Sorry for my bad english!!!
Buy Slurm :D
faustogabiou
Newbie
*
Offline Offline

Posts: 14


View Profile
« Reply #8 on: 02-09-2009 17:28:35 »

Thanks a lot for this, Bronco!

I have a question:

category: domain.com/images/categoryname/subcategory.html
image: domain.com/images/category/subcategory/idimage-imagetitle.html

Is it possible to change image path to: domain.com/images/category/subcategory/imagetitle.html ?
It means, remove the idimage.
Logged
BrOncO
Newbie
*
Offline Offline

Posts: 19



View Profile WWW
« Reply #9 on: 02-09-2009 19:48:00 »

Thanks a lot for this, Bronco!

I have a question:

Is it possible to change image path to: domain.com/images/category/subcategory/imagetitle.html ?
It means, remove the idimage.

need to change part of the code, but idimage is for not ave 2 images with same link, for a multiuser gallery is necessary.
Logged

Sorry for my bad english!!!
Buy Slurm :D
faustogabiou
Newbie
*
Offline Offline

Posts: 14


View Profile
« Reply #10 on: 02-09-2009 21:23:18 »

need to change part of the code, but idimage is for not ave 2 images with same link, for a multiuser gallery is necessary.
Thought so. Got the idea of why is mandatory for multiuser gallery. My case is a only-admin-edit gallery with a loooot of images!

Well, I dug into the code and changed this line:
Code:
$segments[] = $query['id'].' '.$imgtitle;

For this:
Code:
$segments[] = $imgtitle;

Then the url went right! However all image links got broken...
Logged
BrOncO
Newbie
*
Offline Offline

Posts: 19



View Profile WWW
« Reply #11 on: 04-09-2009 03:48:35 »

the plugin  find the normal joomla link by the imageid and not the name

domain.com/joomgallery/category/idimage-title
is same to
domain.com/joomgallery/category/idimage

for delete the id is necessary change

the function joom_catid()
this part: //if more segments is a subcategory or image
delete the function replacespecial($string)

Logged

Sorry for my bad english!!!
Buy Slurm :D
BrOncO
Newbie
*
Offline Offline

Posts: 19



View Profile WWW
« Reply #12 on: 04-09-2009 04:52:07 »

   
try this router, but images name can not have "-" in the name ( or symbols set in the $rparams['space'] options)
Logged

Sorry for my bad english!!!
Buy Slurm :D
faustogabiou
Newbie
*
Offline Offline

Posts: 14


View Profile
« Reply #13 on: 04-09-2009 22:42:35 »

   
try this router, but images name can not have "-" in the name ( or symbols set in the $rparams['space'] options)

Works perfectly, awesome! Shocked Thanks ad infinitum, B.!
Hope this helps others too!
Logged
rigo
Newbie
*
Offline Offline

Posts: 3


View Profile
« Reply #14 on: 04-09-2009 22:51:54 »

Hi BrOncO, thanks you for your work.  Smilewinkgrin

I had troubles with special characters replacement in category names. The router don't make that replacement. I found that inserting a line in "joom_catpath" function, category names replace special characters too.

The function looked like this:

Code
function joom_catpath($catid, &$database) {
 $segments = array();
 $i = 0;
 while ( $catid != 0 ) {
   $database->setQuery("SELECT name, parent FROM #__joomgallery_catg WHERE cid=".(int) $catid);
   $category = $database->LoadObject();
   $segments[$i] = $category->name;
   //$segments[$i] = utf8_decode($category->name);
   $catid = $category->parent;
   $i++;
 }
 if($i > 1) $segments = array_reverse($segments);
 return $segments;
}

Now it looks like this:

Code
function joom_catpath($catid, &$database) {
 $segments = array();
 $i = 0;
 while ( $catid != 0 ) {
   $database->setQuery("SELECT name, parent FROM #__joomgallery_catg WHERE cid=".(int) $catid);
   $category = $database->LoadObject();
   $segments[$i] = $category->name;
   //$segments[$i] = utf8_decode($category->name);
   $segments[$i] = replacespecial($category->name); //<-----------------------------------extra line
   $catid = $category->parent;
   $i++;
 }
 if($i > 1) $segments = array_reverse($segments);
 return $segments;
}

It works for me, but may be you have another solution. It would be fine if the original router replace characters in category names too.
Regards :)
« Last Edit: 04-09-2009 22:57:57 by rigo » Logged
Pages: [1] 2 3 ... 5
Print
Jump to:  

HOSTED BY SCHWARZKÜNSTLER ®

PROTECTED BY  ZB BLOCK  AND Project Honey Pot
Theme orange-lt created by panic

Bad Behavior has blocked 6814 access attempts in the last 7 days.