Making links with append_sid

Discussion forum for MOD Writers regarding MOD Development.
Locked
Jhonne
Registered User
Posts: 21
Joined: Sat Feb 27, 2010 7:36 pm

Making links with append_sid

Post by Jhonne » Sat Nov 12, 2011 2:32 pm

I have a page with the privacy policy of my site. I am trying to make a link with append_sid so I wrote this in functions.php

Code: Select all

		'U_FAQ'					=> append_sid("{$phpbb_root_path}faq.$phpEx"),
		'U_PRIVACY'				=> append_sid("{$phpbb_root_path}privacy-policy.$phpEx"),
When I look at the urls I get this meaning the privacy policy link will only work from the root pages, what is the cause of this?

http://www.website.com/faq.php
./privacy-policy.php

User avatar
AmigoJack
Registered User
Posts: 5588
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Making links with append_sid

Post by AmigoJack » Mon Nov 14, 2011 5:29 am

Have a look at this site's source and you'll notice the very same link. {$phpbb_root_path} does not less than it's named like: it makes the board installation path the base.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

User avatar
Sniper_E
Registered User
Posts: 775
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey
Contact:

Re: Making links with append_sid

Post by Sniper_E » Mon Nov 14, 2011 5:54 am

Is your privacy-policy.php file a phpBB file, part of your forum?
Is that file located in the root directory of your forum with the faq.php?
Does that file call for a privacy-policy.html template in your template directory?
Do you also have a language/en/privacy-policy.php setup for that page?

I'm just wondering what type of file you are trying to add sid to in your link.
I'm not sure adding sid to an external file would be right.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
:!: Sniper_E Styles | phpbbmodders :!:

Jhonne
Registered User
Posts: 21
Joined: Sat Feb 27, 2010 7:36 pm

Re: Making links with append_sid

Post by Jhonne » Mon Nov 14, 2011 9:05 am

privacy-policy.php is locacted in the root directory, same as the faq.php and it calls for a privacy.html in the template directory. It does not have an own language setup, should it be needed?

This is how privacy-policy.php looks like:

Code: Select all

<?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

	// Output page
	page_header($user->lang['INDEX']);

    $template->set_filenames(array(
        'body' => 'privacy.html',
    ));
	
    page_footer();
?>

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51719
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Making links with append_sid

Post by Brf » Mon Nov 14, 2011 12:25 pm

It should all work fine. Are you having a problem?

Jhonne
Registered User
Posts: 21
Joined: Sat Feb 27, 2010 7:36 pm

Re: Making links with append_sid

Post by Jhonne » Mon Nov 14, 2011 4:45 pm

My problem is that when on a page outside the root folder I get this url website.com/folder/privacy-policy.php instead of website.com/privacy-policy.php but the faq page works.

If I write out the both urls in plan text the {U_FAQ} looks like this http://www.website.com/faq.php and {U_PRIVACY} like this ./privacy-policy.php.

I want the U_PRIVACY to write out the full url.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51719
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Making links with append_sid

Post by Brf » Mon Nov 14, 2011 5:01 pm

Those are relative URLs -- relative to the calling page. Your PHP file, in the other folder, should have a proper phpbb_root_path defined, so the URL gets the proper relative path. Otherwise you would not have even been able to include common.php properly.

Locked

Return to “[3.0.x] MOD Writers Discussion”