Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-24-2014, 09:45 PM
ub.ch ub.ch is offline
 
Join Date: Jul 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Make pretty URLs in my plugin

Heya!

I want to use pretty URLs in my plugin (a marketplace) and can't seem to figure out how vBulletin does it

So I have something like this:

PHP Code:
/marketplace.php?do=article&id=
and would like to be

PHP Code:
/marktplatz/9-da-vinci-code 
so coming from standard PHP with URL parameters, I would like to have a german rewrite (seeing my forum is german), the article ID and the name of the article (in this case the name of the book)

So far the .htaccess is the "easy" way - if I add

PHP Code:
RewriteRule ^marktplatz/.* marketplace.php [QSA
I do see the marketplace.php (but just this one, no parameters used), but now I am sort of stuck on how to tell my plugin to use and parse the new URL structure.

Looking in members.php or other standard vBulletin pages did not seem to help and now I am asking you for any help

One (imho ugly) way would be to access $_SERVER['REQUEST_URI'] and parse everything to only give me the ID 9, but this seems a bit over the top.
I am sure there is another way, but I just don't know where to look

Thanks for any help!
Best
Malte
Reply With Quote
  #2  
Old 09-24-2014, 10:31 PM
MirKO13 MirKO13 is offline
 
Join Date: May 2009
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you tried "Mod Rewrite Friendly URLs" yet?
In Control Panel,Options, Friendly URLs....

Not sure if that's what You're looking for .
Good Luck
Reply With Quote
  #3  
Old 09-25-2014, 06:48 AM
ub.ch ub.ch is offline
 
Join Date: Jul 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes I have - it is turned on in my forum and it works fine.

I am more asking for the technical / code implementation.
So what are available parameters / variables so I can access 9-da-vinci-code or even better have it parsed so I have just the ID

I have found functions like fetch_seo_url(), but they don't seem to help
Reply With Quote
  #4  
Old 09-25-2014, 01:51 PM
webmastersun's Avatar
webmastersun webmastersun is offline
 
Join Date: Oct 2013
Location: www.webmastersun.com
Posts: 433
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Enable friend url in control panel, it's enough for you to have friendly URLs on your site
Reply With Quote
  #5  
Old 09-25-2014, 06:38 PM
ub.ch ub.ch is offline
 
Join Date: Jul 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am not sure if I am making myself clear: I do know how to enable enable it. It is already in use. My question is, how do I as adeveloper make use of the feature in my own self coded plugin
Reply With Quote
  #6  
Old 09-25-2014, 09:52 PM
MirKO13 MirKO13 is offline
 
Join Date: May 2009
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have You tried any SEO software yet? Like DragonByte SEO?.

Quote:
AddOn Support

Allows other modifications to add their own rewrite rules / sitemap integration
Reply With Quote
  #7  
Old 09-26-2014, 04:01 PM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Neither of the suggestions up to now will help him. He has no issues with friendly URLs in his forum. He has coded an addon, and he wants to hook that addon into the vB friendly URL system. He wants to make the URLs that his addon creates to be friendly.

I can't immediately help with the issue at hand, but more suggestions to get vB's friendly URLs running or buy expensive addons won't help him
Reply With Quote
  #8  
Old 09-26-2014, 04:16 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Take a look at the function fetch_seo_url

https://members.vbulletin.com/api/vB...nfetch_seo_url
Reply With Quote
  #9  
Old 09-26-2014, 04:25 PM
ub.ch ub.ch is offline
 
Join Date: Jul 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cellarius View Post
Neither of the suggestions up to now will help him. He has no issues with friendly URLs in his forum. He has coded an addon, and he wants to hook that addon into the vB friendly URL system. He wants to make the URLs that his addon creates to be friendly.

I can't immediately help with the issue at hand, but more suggestions to get vB's friendly URLs running or buy expensive addons won't help him
Thanks
I was starting to think I am not explaining myself clear enough
Quote:
Originally Posted by Lynne View Post
Take a look at the function fetch_seo_url

https://members.vbulletin.com/api/vB...nfetch_seo_url
Thanks! But as mentioned in a post above I have already stumbled upon this function.
As far as I understand this is to generate a SEO URL but not parse an existing one :/

But I just found this thread https://vborg.vbsupport.ru/showthread.php?t=241364
(funny, earlier searches did show only good results...)

I'll read into this and keep you posted!
Reply With Quote
  #10  
Old 09-26-2014, 04:30 PM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

But your problem is about generating one. You need to generate it whenever you link to pages of your addon.

Parsing does not happen in vB. That happens in .htaccess. You need an .htaccess entry that changes
Code:
/marktplatz/9-da-vinci-code
back to
Code:
/marketplace.php?do=article&id=9
Look at vB4's existing .htaccess file to get inspiration.

Edit: OK, rereading your post, you already know that and are explicitly asking for that But don't forget: the htaccess alone will not suffice - you also need to properly generate the URLs in vB. I am, however, not sure what a "german rewrite" exactly means...

Anyway, rewriting as you wish seems problematic, since you have two parameters in your standard URL, but only one in the friendly one.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:18 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04150 seconds
  • Memory Usage 2,262KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (3)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete