Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: avwebsites on February 15, 2019, 06:54:46 PM

Title: Server Side Includes - .php SMF 2.0.15
Post by: avwebsites on February 15, 2019, 06:54:46 PM
Greetings, everyone:

I have been reading the SSI instructions here:

http://www.simplemachines.org/community/ssi_examples.php

I love how easy it is to integrate SMF.

The one thing I don't see is how to identify a single board.  I'm running a url mod that uses (I assume) a url rewrite for SEO friendly urls.

So I'm looking at this code here:

<?php ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo'); ?>

...and I'm wanting to specify ONLY one specific board to include.

1.  I'm not quite sure what the board identifier is

2.  I assume that I simply remove the exclusion code and use the $include_boards = "X".

If I'm right, then I simply need to know how to ID the board in question!

Thanks!
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: Arantor on February 15, 2019, 06:59:13 PM
Not quite.

If the board URL is index.php?board=1.0, the include board will be 1.

BUT, you have to include all the parameters up to that point, e.g.

ssi_recentTopics(8, null, 1);

(Please don't just have all the variables, it really doesn't do what people think it is does; you can't just change which thing PHP will care about just because you changed the name)
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: avwebsites on February 15, 2019, 07:33:18 PM
Hi Arantor:

Great, thanks for the tips!

The url rewrite mod has renamed (for example) a topic to:  /topic,12.0.html.  Based on your information, I can conclude that the topic identifier is simply '12'.  Simple enough!
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: Arantor on February 15, 2019, 07:36:33 PM
ssi_recentTopics only does recent topics of one or more boards, it doesn't transplant an individual topic's replies...
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: avwebsites on February 15, 2019, 08:55:28 PM
Ok, so:

<?php ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo'); ?>

...yielded the expected results of the last 8 topics.

<?php ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = 12, $output_method = 'echo'); ?>

This did not change the output at all.  Any changes I make to the variables above either have no effect, or crash the script.
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: Kindred on February 15, 2019, 11:12:16 PM
You don't need the variable names

(8, null, 2, 'echo')

Will pull from board 2...    do you have a board 12?
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: Arantor on February 16, 2019, 03:05:47 AM
Moreover, the variable names explicitly do something different (they make new variables with those names!)
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: avwebsites on February 16, 2019, 10:32:17 AM
Yes, I tried the coding without the variable names first.  Then I simply copied and pasted the code from the SMF SSI examples page, because the code wasn't working.  I assumed that there was a problem with my syntax.  It's all usually user error. :)

....but no dice.

It's not critical that I embed the board, it just seemed like a good idea.

PHP version: 7.2.7
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: Arantor on February 16, 2019, 11:12:10 AM
SMF doesn't play nice on PHP 7.2.

Also, you say it doesn't work but you don't explain in what way it doesn't work, makes it hard to help ;)
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: avwebsites on February 16, 2019, 11:30:11 AM
What would be the recommended version of pHp?  This is good to know, as I should be able to change the pHp version.

I looked but I didn't see a system requirements page in the manual.

I haven't actually looked at the log for errors, I just noticed that there is no output at all.

Thanks! :)
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: avwebsites on February 16, 2019, 11:34:11 AM
...I found the server requirements page, but I didn't see a "recommended" pHp version... just a recommendation of a version greater than 5.5.
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: Arantor on February 16, 2019, 05:26:38 PM
Recommended PHP version for SMF, probably 7.0 unless you have mods that don't work in that version.
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: Kindred on February 16, 2019, 05:36:53 PM
Quote from: Kindred on February 15, 2019, 11:12:16 PM
do you have a board 12?
Title: Re: Server Side Includes - .php SMF 2.0.15
Post by: avwebsites on February 16, 2019, 06:19:46 PM
Hi -

Actually, it turns out I was trying to run an older pHp version.  As per your advice, I switched to version 7.0 and that solved the problem.

I'm actually surprised that this was the only problem I had run into!

I appreciate the help!