News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

SSI cannot grab full address only index.php

Started by diontoradan, January 03, 2011, 03:45:50 PM

Previous topic - Next topic

diontoradan

Hello,

i know this is a stupid question, but i tried to search for this question but i cannot find any.

the problem is i use SSI to grab content from my forum, but the forum link act bizarre when i install the code outside forum.
instead of getting domain.com/forum/index.php?xxx, it only display domain.com/index.php?xxx (without the /forum).

how can i get the $scripturl to work properly?

many thanks...


JBlaze

Make sure $scripturl is brought into scope.

global $scripturl;
Jason Clemons
Former Team Member 2009 - 2012

Ant59

I have the same problem. JBlaze, your fix doesn't work.

hadesflames


Ant59

Sure :)


<?php
global $scripturl;
require_once($home_dir.'forum/SSI.php');
$news ssi_boardNews(28nullnull'array');
foreach ($news as $item)
{
echo '
<div class="news_item">
<h3 class="news_header"><a href="'
.$item['href'].'">'.$item['subject'].'</a></h3>
<div class="news_timestamp">Posted '
.$item['time'].' by '.$item['poster']['link'].'</div>
<div class="news_body" style="padding: 2ex 0;">'
$item['body'], '</div>
'
$item['link'], $item['locked'] ? ' | Topic Locked' ' | ' $item['comment_link'], '
</div>'
;
}
?>


hadesflames

Give this a shot:

<?php
      
require_once(__FILE__ 'forum/SSI.php');
      global 
$scripturl;
      
$news ssi_boardNews(28nullnull'array');
      foreach (
$news as $item)
      {
         echo 
'
            <div class="news_item">
               <h3 class="news_header"><a href="'
.$item['href'].'">'.$item['subject'].'</a></h3>
               <div class="news_timestamp">Posted '
.$item['time'].' by '.$item['poster']['link'].'</div>
               <div class="news_body" style="padding: 2ex 0;">'
$item['body'], '</div>
               '
$item['link'], $item['locked'] ? ' | Topic Locked' ' | ' $item['comment_link'], '
            </div>'
;
      }
   
?>

Arantor

Well, if you're not getting the full link, something's actually wrong since it's derived from the $boardurl itself which means $boardurl is probably set wrong in your forum anyway...

What is the entry in Admin > Server Settings > Database and Paths > Forum URL ?

Ant59

#8
Quote from: hadesflames on January 09, 2011, 06:59:48 PM
Give this a shot:

<?php
      
require_once(__FILE__ 'forum/SSI.php');
      global 
$scripturl;
      
$news ssi_boardNews(28nullnull'array');
      foreach (
$news as $item)
      {
         echo 
'
            <div class="news_item">
               <h3 class="news_header"><a href="'
.$item['href'].'">'.$item['subject'].'</a></h3>
               <div class="news_timestamp">Posted '
.$item['time'].' by '.$item['poster']['link'].'</div>
               <div class="news_body" style="padding: 2ex 0;">'
$item['body'], '</div>
               '
$item['link'], $item['locked'] ? ' | Topic Locked' ' | ' $item['comment_link'], '
            </div>'
;
      }
   
?>


Copied your code exactly. Still no joy :(

Quote from: IncognitoMuse on January 09, 2011, 07:50:45 PM
Well, if you're not getting the full link, something's actually wrong since it's derived from the $boardurl itself which means $boardurl is probably set wrong in your forum anyway...

What is the entry in Admin > Server Settings > Database and Paths > Forum URL ?

Tried this already. Everything is set correctly.

Forum URL is set to "http://67.23.243.193/forum"

Illori

can this be moved to the coding board where the user(s) may get better support?

Ant59

Quote from: Illori on January 10, 2011, 05:47:13 AM
can this be moved to the coding board where the user(s) may get better support?

This isn't a coding question. It's a question of how to get the SSI functionality working correctly.

Illori

which is working with code... and not a feature in the core of smf.

Ant59

Quote from: Illori on January 10, 2011, 05:50:54 AM
which is working with code... and not a feature in the core of smf.

Actually, SSI is a core SMF feature. It's not an addition to the coding, or even a modification of it.

Anyway, this isn't helping me with an answer. If you can't help me, please don't post in this topic.

Illori

i was trying to get you further help by getting it moved, i know it is a core feature but the way you are using it requires code... hence moving it to the coding board, but whatever you want. less coding people would read this board and hence less support you would get on your issue.

Arantor

Technically, this can be argued either way :P I'd argue it should be in the Coding Discussion board and were I a moderator I'd move it there, but that's me. Anyway, that's off topic.


OK, do you have any portal mods installed? Anything of the pretty URLs type mods? (Anything that rewrites URLs, basically)

Ant59


Arantor

You mentioned above your board's URL as being that IP address based URL... that is what is in $boardurl in Settings.php, right? (It should be, but no harm in checking.) Oh, and you don't need to bring $scripturl into scope in that page, it's managed by SSI.php.

Any errors in the error log?

Out of interest, that page you mention, that is the entire page and not an include to something else?

Ant59

Quote from: IncognitoMuse on January 10, 2011, 06:05:15 AM
You mentioned above your board's URL as being that IP address based URL... that is what is in $boardurl in Settings.php, right? (It should be, but no harm in checking.)

Yeah it's set right in Settings.php

Quote from: IncognitoMuse on January 10, 2011, 06:05:15 AM
Oh, and you don't need to bring $scripturl into scope in that page, it's managed by SSI.php.

Yeah, I figured that, but tried it anyway.

Quote from: IncognitoMuse on January 10, 2011, 06:05:15 AM
Any errors in the error log?

No related errors.

Quote from: IncognitoMuse on January 10, 2011, 06:05:15 AM
Out of interest, that page you mention, that is the entire page and not an include to something else?

It is the whole page, but does pull parts through functions on an include.

Arantor

And you have no other mods at all?

* IncognitoMuse is really confused.

Since $scripturl is defined in QueryString.php as $boardurl . '/index.php', unless $boardurl is wrong, it should be just fine...

That said, there are circumstances where $scripturl gets rewritten, but that's to include PHPSESSID, rather than anything else... curiouser and curiouser. Random question: are subdomain independent cookies on or off?

Ant59

Tried subdomain independent cookies on and off. Off atm.

Advertisement: