News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Problem with SSI in links

Started by Smith.93, January 31, 2014, 10:11:02 PM

Previous topic - Next topic

Smith.93

Hey guys, my English is very poor, forgive me if I express myself badly

I have a problem with SSI.php when I click on the links. For starters I have to clarify something, I am using xampp and the directory is as follows

localhost / xampp / htdocs / web   <---- my website
localhost / xampp / htdocs / forum <--- my forum

In the index of my website I put the following tag before the <html>:


require("../forum/SSI.php");


And then I called the function ssi_recentTopics():


<blockquote class="home">
<?php ssi_recentTopics(); ?>
</blockquote>


The result is this:


You see properly but the link is wrong. the link to the topic "CACAC" is this:

http://127.0.0.1/[color=red]web[/color]/index.php?topic=2.msg2;topicseen#new

But this should be:

http://127.0.0.1/[color=red]forum[/color]/index.php?topic=2.msg2;topicseen#new

How I can fix this?

Arantor

That would imply that SMF is misconfigured. What does Settings.php say for $boardurl? (DO NOT INCLUDE THE ENTIRE FILE. JUST THAT ONE LINE.)
Holder of controversial views, all of which my own.


Smith.93

#2
 Hello Sir Cumber-Patcher Hello, thank you very much for responding.

In the settings.php file the "boardurl" line is this:


$boardurl = 'http://127.0.0.1/forum'; # URL to your forum's folder. (without the trailing /!)


Try removing the / but still does not work
I don't understand when you said this:

Quote
(DO NOT INCLUDE THE ENTIRE FILE. JUST THAT ONE LINE.)

that only include a line?

Arantor

No, I just meant for you to tell me that one line instead of posting the whole file because it contains passwords and so on.

That's also really strange, because SSI should use $boardurl as the base for making links...
Holder of controversial views, all of which my own.


Kindred

unless he has some sort of re-write?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Smith.93

I would never change anything to the file, as this is the default.
To see if it works, I edited the file like this:


$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['board_name'],
'href' => '127.0.0.1/forum/index.php?board=' . $row['id_board'] . '.0',
'link' => '<a href="127.0.0.1/forum/index.php?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'href' => '127.0.0.1/forum/index.php?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="127.0.0.1/forum/index.php?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new" rel="nofollow">' . $row['subject'] . '</a>',
// Retained for compatibility - is technically incorrect!
'new' => !empty($row['is_read']),
'is_new' => empty($row['is_read']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" />',
);


And the link looks like:

http://127.0.0.1/web/127.0.0.1/forum/index.php??board=1.0


No way to delete the first http://127.0.0.1/web/?

Kindred

oh. I see the possible problem

The apache handler assumes that anything NOT prefixed with http:// is a RELATIVE path... and so, it inserts the current url/path in front.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Smith.93

Quote from: Kindred on February 01, 2014, 06:02:01 PM
oh. I see the possible problem

The apache handler assumes that anything NOT prefixed with http:// is a RELATIVE path... and so, it inserts the current url/path in front.

You're a genius!!
Thank you very much, really!

Arantor

That's not the Apache handler, that's how every single URL is built anywhere... if it doesn't say http or https at the start, it's explicitly assumed to be relative to the current page.
Holder of controversial views, all of which my own.


Kindred

Yes... But I thought that it was the server side handler that made that assumption.

Regardless of the actual thing making the assumption, it would seem to be the issue.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: