Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: eddie1973 - lokakuu 22, 2013, 02:48:50 AP

Otsikko: Using the SSI
Kirjoitti: eddie1973 - lokakuu 22, 2013, 02:48:50 AP
I am trying to show my latest post on my main page. It is a .php. When I add it, my page gets all whacked and I have a error

Fatal error: Call to undefined function ssi_recentPosts() in /home/flyakaco/public_html/lib/skins/flyalaska_1.0/frontpage_main.php on line 263

I put the SSI line on top of the <html>

and I am using <?php ssi_recentPosts(); ?> for the recent post. Any help would be appreciated.
Otsikko: Re: Using the SSI
Kirjoitti: Colin - lokakuu 22, 2013, 02:51:40 AP
Hello!

Did you add <?php require("/path/to/forum/SSI.php"); ?> above your function call?
Otsikko: Re: Using the SSI
Kirjoitti: Kindred - lokakuu 22, 2013, 02:52:07 AP
specifically WHAT line did you place at the top of the file?

and where is your frontpage_main.php file location, with relation to SSI.php?
In other words, I see that frontpage_main.php is in /home/flyakaco/public_html/lib/skins/flyalaska_1.0/
where is SSI.php?
Otsikko: Re: Using the SSI
Kirjoitti: eddie1973 - lokakuu 22, 2013, 03:33:34 AP
Lainaus käyttäjältä: Kindred - lokakuu 22, 2013, 02:52:07 AP
specifically WHAT line did you place at the top of the file?

and where is your frontpage_main.php file location, with relation to SSI.php?
In other words, I see that frontpage_main.php is in /home/flyakaco/public_html/lib/skins/flyalaska_1.0/
where is SSI.php?

It's in the layout.php, same file as all the js and css lines go. I have this on the top of the <html>.

<?php require("/home/flyakaco/public_html/forums/SSI.php"); ?>

The layout.php is outside the foums table

/public_html/lib/skins/flyalaska_1.0/layout.php

/public_html/forums/SSI.php
Otsikko: Re: Using the SSI
Kirjoitti: margarett - lokakuu 22, 2013, 04:38:38 AP
But, looking at your error, it comes from "frontpage_main.php" and not from "layout.php"...
Otsikko: Re: Using the SSI
Kirjoitti: eddie1973 - lokakuu 22, 2013, 04:43:09 AP
Yes, layout.php is the file that has all the css and js, jquery, etc. frontpage_main in the actual content.

It's a template based CMS
Otsikko: Re: Using the SSI
Kirjoitti: margarett - lokakuu 22, 2013, 04:52:45 AP
OK, and does "frontpage_main.php" features the require SSI.php line also?
Otsikko: Re: Using the SSI
Kirjoitti: eddie1973 - lokakuu 22, 2013, 04:56:33 AP
No, there is no <html> the <html> is only in layout.php
Otsikko: Re: Using the SSI
Kirjoitti: margarett - lokakuu 22, 2013, 05:16:35 AP
But if you are calling that function in that file, you *have* to let PHP know where it comes from...
And you can use SSI functions in the "array" output method, in which the functions will return the data in an array of content, instead of printing it out directly. This way you can fetch your data in one file and show it in another file (like SMF, itself, does)
Otsikko: Re: Using the SSI
Kirjoitti: Kindred - lokakuu 22, 2013, 07:35:48 AP
See....   you are requiring SSI into layout.php - but you are calling the function from frontpage_main.php

and why would it matter if frontpage_main.php had an html tag?
Otsikko: Re: Using the SSI
Kirjoitti: eddie1973 - lokakuu 22, 2013, 10:54:15 AP
same problem when I put it in frontpage_main.php
Otsikko: Re: Using the SSI
Kirjoitti: margarett - lokakuu 22, 2013, 11:02:07 AP
At this point, you would have to share with us which CMS are you using and, most likely, what are you doing within the code.
I'm guessing you are using some king of OOP-based CMS and, in that case, you probably have to require the file in several places or, at least, in the adequate places...

BTW, moving to Coding ;)
Otsikko: Re: Using the SSI
Kirjoitti: emanuele - lokakuu 22, 2013, 12:44:00 IP
Likely it's enough to use require_once instead of require.