Advertisement:

Author Topic: public-profile url format  (Read 3511 times)

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: public-profile url format
« Reply #45 on: March 28, 2019, 08:43:17 am »
We change this url:

With permalink: mysite.com/profile/user-name1
Without permalink: mysite.com/index.php?page=user&action=pub_profile&id=1

To this:

mysite.com/user-name1


What values should i put for arguments in this function:
osc_add_route($id, $regexp, $url, $file)
« Last Edit: March 28, 2019, 08:54:36 am by Sophia_OS »

Web-Media

  • Sr. Member
  • ****
  • Posts: 451
  • Web
Re: public-profile url format
« Reply #46 on: March 28, 2019, 10:19:36 am »
https://github.com/osclass/plugin-routes_example
Where did you get the idea of yoursite.com/user-cristiano1 ?
You will nedd a separator between name /itemsperpage/page
You are on dinamic routes

Web-Media

  • Sr. Member
  • ****
  • Posts: 451
  • Web
Re: public-profile url format
« Reply #47 on: March 28, 2019, 10:50:16 am »
Your options are
Using rewrite
Site.com/users/cristiano?ipp=10&page=2
Using routes
Site.com/cristiano/10/2
Or site.com/user-cristiano/10/2
Using main controller
Site.com/?cristiano/10/2

Web-Media

  • Sr. Member
  • ****
  • Posts: 451
  • Web
Re: public-profile url format
« Reply #48 on: March 28, 2019, 10:55:19 am »
osc_add_route($user[s'username], $user[s'username]/([0-9]+)/([0-9]+)', '$user[s'username]/{my-numeric-param}/{my-own-param}',
Check the db field name .. $user['s_username]...im on mobile

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: public-profile url format
« Reply #49 on: March 28, 2019, 07:23:40 pm »
osc_add_route($user[s'username], $user[s'username]/([0-9]+)/([0-9]+)', '$user[s'username]/{my-numeric-param}/{my-own-param}',
Check the db field name .. $user['s_username]...im on mobile

But i don't want :
site.com/user-cristiano/10/2

I want:
site.com/user-cristiano

Web-Media

  • Sr. Member
  • ****
  • Posts: 451
  • Web
Re: public-profile url format
« Reply #50 on: March 28, 2019, 08:15:39 pm »
Hope you are kidding . And how do you display page 2 , page 5
 How do you know how many items per page .
Y did laugh at your joke  :) ;D

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: public-profile url format
« Reply #51 on: March 28, 2019, 11:36:16 pm »
Hope you are kidding . And how do you display page 2 , page 5
 How do you know how many items per page .
Y did laugh at your joke  :) ;D

i'm so sorry  :) i thought that's the public-profile main url! but that's the pages for user's items! sorry!

now for making site.com/user-cristiano we should do this? right?
osc_add_route($user[s'username], $user[s'username]/([0-9]+)/([0-9]+)', '$user[s'username]/{my-numeric-param}/{my-own-param}');

Web-Media

  • Sr. Member
  • ****
  • Posts: 451
  • Web
Re: public-profile url format
« Reply #52 on: March 29, 2019, 12:55:01 am »
osc_add_route($user['s_username'], 'user-'.$user['s_username']/([0-9]+)/([0-9]+)', 'user-'.$user['s_username']/{my-numeric-param}/{my-own-param}','yourplugin_file .php',false,'custom','custom','Profile page of'.$user['s_username']);

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: public-profile url format
« Reply #53 on: March 29, 2019, 03:16:21 am »
osc_add_route($user['s_username'], 'user-'.$user['s_username']/([0-9]+)/([0-9]+)', 'user-'.$user['s_username']/{my-numeric-param}/{my-own-param}','yourplugin_file .php',false,'custom','custom','Profile page of'.$user['s_username']);

What should we put for these:
{my-numeric-param}
{my-own-param}

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: public-profile url format
« Reply #54 on: March 29, 2019, 06:28:30 am »
Other users please don't just watch, leave your comments and cooperate to solve this topic! Thanks!

Web-Media

  • Sr. Member
  • ****
  • Posts: 451
  • Web
Re: public-profile url format
« Reply #55 on: March 29, 2019, 09:26:58 am »
Use descriptive param name .. like ipp page . Any words will do the job .
Use the same  for reverse routing on
osc_route_url....
Y will build you the plugin this week end .

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: public-profile url format
« Reply #56 on: March 29, 2019, 09:41:08 am »
Use descriptive param name .. like ipp page . Any words will do the job .
Use the same  for reverse routing on
osc_route_url....
Y will build you the plugin this week end .

Thank you!

Resta

  • Sr. Member
  • ****
  • Posts: 339
Re: public-profile url format
« Reply #57 on: March 30, 2019, 01:16:45 am »
Other users please don't just watch, leave your comments and cooperate to solve this topic! Thanks!
Good advice - you should do the same and "may be I am wrong" when I say this but for the time I have been a member here, I have not come across any threads where you have responded to someone else looking for help or contributed to any other topics, other than those topics where you are looking for solution to your own issues and I think you have more knowledge about osclass than many new users here, whom you can help.
« Last Edit: March 30, 2019, 01:27:53 am by Resta »

Web-Media

  • Sr. Member
  • ****
  • Posts: 451
  • Web
Re: public-profile url format
« Reply #58 on: March 31, 2019, 06:16:35 pm »
Done 98 % . Some small issues with pagination , but works well .
 I,ve saved a lot of memory usage by adding 1 single route , not all users in database  ;)
No changes in core osclass files .
No changes in theme files.
Yoursite.com /user-cris is available
 also with pagination
Yoursite.com /user-cris/10/2

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: public-profile url format
« Reply #59 on: April 01, 2019, 03:23:47 am »
Done 98 % . Some small issues with pagination , but works well .
 I,ve saved a lot of memory usage by adding 1 single route , not all users in database  ;)
No changes in core osclass files .
No changes in theme files.
Yoursite.com /user-cris is available
 also with pagination
Yoursite.com /user-cris/10/2

Well done! Would you please share the code with us!