functions_cute_url.php

Support for the phpbbmodders_lib.
User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor

Re: functions_cute_url.php

Postby igorw » 13 Mar 2010, 10:57

Read the hooks_system.html in the docs folder of phpBB. All you have to do is name the file accordingly (hook_something.php?) and put it into includes/hooks. And you need to make sure cute_urls are available globally.

imkingdavid
Supporter
Supporter
Posts: 32
Joined: 12 Aug 2009, 16:16
Real name: David

Re: functions_cute_url.php

Postby imkingdavid » 13 Mar 2010, 13:58

eviL<3 wrote:Read the hooks_system.html in the docs folder of phpBB. All you have to do is name the file accordingly (hook_something.php?) and put it into includes/hooks. And you need to make sure cute_urls are available globally.

Alright, cool. I'm sorta new to hooks, so this will be a good opportunity to learn. :beer:

EDIT: Sweet, I figured it out! Thanks for the work you put into making those functions/hooks!
phpBB.com Development Team Member | View My MODs | View My Website
Please do NOT contact for support via PM or email.

User avatar
Derky
Supporter
Supporter
Posts: 27
Joined: 21 Aug 2006, 19:23
Real name: Derk
Location: The Netherlands

Re: functions_cute_url.php

Postby Derky » 05 Oct 2010, 21:03

This hook was messing up stuff regarding email files:

Code: Select all

General Error
template->_tpl_load(): No file specified for handle body


With some testing together with Igor, this is the solution:

Open: includes/template.php
Find:

Code: Select all

if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))

Replace with:

Code: Select all

if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once, $this))


Open: includes/hooks/hook_fix_url.php
Find:

Code: Select all

function template_display_fix_url(&$hook, $handle, $include_once = true)
{
    global $template;&nbsp;&nbsp;&nbsp;&nbsp

Replace with:

Code: Select all

function template_display_fix_url(&$hook, $handle, $include_once = true, $template)
{&
nbsp;Â
ImagephpBB3 Styles • phpBB3 Styles Demo • phpBB3 Styles Database

User avatar
tumba25
Past Contributor
Past Contributor
Posts: 1058
Joined: 24 Oct 2007, 13:10
Real name: Jari Kanerva
Location: Kokkola, Finland.

Re: functions_cute_url.php

Postby tumba25 » 05 Oct 2010, 23:10

Thanks for the fix, Derky and Igor.

User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian

Re: functions_cute_url.php

Postby Obsidian » 12 Oct 2010, 15:52

FWIW, the OpenFlame dev team has developed something inspired by the cute_urls code, with some improvements.
http://github.com/OpenFlame/OpenFlame-F ... andler.php
With OfUrlHandler->checkExtra() you can also check if there is any other parts to the path specified left

i.e. if you are expecting http://yoursite/page/somepage/ but not http://yoursite/page/somepage/someextra ... should404/ then you can use the checkExtra() call to detect that there is another entry for 'someextrastuff' and 'pageshould404' and be able to properly react to it (like, 404'ing because the page specified is invalid)

At the moment, cute_urls does not provide this functionality at all.

There are a few other improvements as well, but I can't think of them off the top of my head.


Also, to note, this is an entirely standalone library file; it is not dependent on the framework it resides in, nor any other system.

Dakin Quelia
New member
New member
Posts: 49
Joined: 12 Nov 2008, 01:26
Real name: Daniel
Location: Belgique

Re: functions_cute_url.php

Postby Dakin Quelia » 06 Oct 2011, 20:08

Hello,

This code works with index.php but if I'm creating others pages this code doesn't work.

I've got : index.php / about.php / etc.

How fix it?

Best regards.

User avatar
tumba25
Past Contributor
Past Contributor
Posts: 1058
Joined: 24 Oct 2007, 13:10
Real name: Jari Kanerva
Location: Kokkola, Finland.

Re: functions_cute_url.php

Postby tumba25 » 07 Oct 2011, 01:33

Did you follow [url=http://phpbbmodders.net/board/viewtopic.php?p=16186#p16186]these instructions[/url]?

Dakin Quelia
New member
New member
Posts: 49
Joined: 12 Nov 2008, 01:26
Real name: Daniel
Location: Belgique

Re: functions_cute_url.php

Postby Dakin Quelia » 07 Oct 2011, 01:36

Yes. But this code doesn't work outside index.php... :s

I'd like this: http://phpbbmodders.net/about/rules/

But I'd like create a separate page for each thing. ;)

Dakin Quelia
New member
New member
Posts: 49
Joined: 12 Nov 2008, 01:26
Real name: Daniel
Location: Belgique

Re: functions_cute_url.php

Postby Dakin Quelia » 07 Oct 2011, 04:09

It's solved.

In htaccess file:

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^about?/([^/]+)?/?([^/]+)?$                     ./about.php?mode=$1 [NC]


;)

marcuseward
New member
New member
Posts: 1
Joined: 23 Jan 2012, 01:46

Re: functions_cute_url.php

Postby marcuseward » 23 Jan 2012, 01:51

Thanks for the codes!


Return to “Library”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests