collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 354
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Author Topic: Help: How to call a SSI.php function within a customized php block?  (Read 3873 times)

0 Members and 1 Guest are viewing this topic.

Offline wjhdiz

  • Semi Newbie
  • *
  • Posts: 29
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Hi,

I want to make a customized php block with some jquery tabs script like

Code: [Select]
        <div id="container-1">
            <ul>
                <li><a href="#fragment-1"><span>One</span></a></li>
                <li><a href="#fragment-2"><span>Two</span></a></li>
                <li><a href="#fragment-3"><span>Tabs are flexible again</span></a></li>
            </ul>
            <div id="fragment-1">
                ssi.php function-1
                <pre><code>$(&#039;#container&#039;).tabs();</code></pre>
            </div>
            <div id="fragment-2">
                ssi.php function-2
            </div>
            <div id="fragment-3">
                ssi.php function-3
            </div>
        </div>

Any help is greatly appreciated.

Thanks in advance.
« Last Edit: September 21, 2010, 11:11:19 PM by wjhdiz »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Help: How to call a SSI.php function within a customized php block?
« Reply #1 on: September 13, 2010, 02:16:29 PM »
This is not strictly a SimplePortal question.
This is php question -- how do you call a function?
 
The short answer is
1) make sure the function is defined (by using require_once for the file with the function definition)
2) Call the function
 
In this case, the function definitions you want are in an SMF file called SSI.php, so that's the file you need.
 
SMF provides some information on how to use the SSI functions:
http://demo.simpleportal.net/ssi_examples.php (for example -- there is one in your SMF installation, too).  In a SimplePortal custom php block, though, you don't use the <?php tag of course. And you want to use require_once instead of require, just in case the file has been included earlier.
 
For an example of SimplePortal code calling an ssi function, look in PortalBlocks.php for ssi_BoardNews.
 
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline wjhdiz

  • Semi Newbie
  • *
  • Posts: 29
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: Help: How to call a SSI.php function within a customized php block?
« Reply #2 on: September 13, 2010, 11:40:06 PM »
Here this one works:

Code: [Select]
echo' <div id="tabs">
<ul>
<li><a href="#tabs-1">First</a></li>
<li><a href="#tabs-2">Second</a></li>
<li><a href="#tabs-3">Third</a></li>
</ul>
<div id="tabs-1">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
<div id="tabs-2">Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum.</div>
<div id="tabs-3">Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.</div>
</div>';

What I don't like is this does not call SSI.php functions. If I want to say add

<?php ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo'); ?> within <div id="tabs-1"> </div>, how should I get this through?
Thanks.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Help: How to call a SSI.php function within a customized php block?
« Reply #3 on: September 14, 2010, 06:32:34 AM »
I can see you are just getting started with programming.
Your question is really just about php programming, rather than about SimplePortal or even about SMF.
You would probably enjoy the php tutorial at http://w3schools.com. There are many other good tutorials, and the manuals at php.net are a very good reference.
 
If you would like to see some php code in action in a SimplePortal block, you can have a look through PortalBlockks.php.  You'll even find function sp_recent, and see how it calls ssi_recentTopics or ssi_recentPosts.
 
---------------
It is also possible that you can achieve the effect you want by calling several SimplePortal blocks directly, in a blocks in blocks technique: http://simpleportal.net/index.php?topic=5332.0
---------------
Since you are already in php mode, you don't have to switch into php mode.
You can handle this simply by ending the echo statement, doing your statement, then doing another echo statement.
 
Code: [Select]
echo'      <div id="tabs">
         <ul>
            <li><a href="#tabs-1">First</a></li>
            <li><a href="#tabs-2">Second</a></li>
            <li><a href="#tabs-3">Third</a></li>
         </ul>
         <div id="tabs-1">
';
         ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo');
 
          echo '</div>
         <div id="tabs-2">Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum.</div>
         <div id="tabs-3">Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.</div>
      </div>';
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline wjhdiz

  • Semi Newbie
  • *
  • Posts: 29
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: Help: How to call a SSI.php function within a customized php block?
« Reply #4 on: September 14, 2010, 10:04:53 AM »
Thanks Angelina.

I am pretty sure this will work. I tried earlier by putting

Code: [Select]
<?php ssi_recentTopics($num_recent 8$exclude_boards null$include_boards null$output_method 'echo'); ?>directly and it surely got error.

This urgent party of my site and really don't have time to go through tutorials. I am readinga book now, but will take some time to bring me to the level needed to work this out.

Thank you very much.
Jimmy

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Help: How to call a SSI.php function within a customized php block?
« Reply #5 on: September 15, 2010, 09:22:00 AM »
Does that solve the problem?
 
Good luck getting started, and I hope you will enjoy learning more about programming.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline wjhdiz

  • Semi Newbie
  • *
  • Posts: 29
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: Help: How to call a SSI.php function within a customized php block?
« Reply #6 on: September 21, 2010, 11:10:56 PM »
Yes, I am becoming more motivited and feel that I have done quite a lot on what I want to with help from good people here.

Thanks.

P.S. Did you realize that ssi_recentEvents returns only today's event? I found it yesterday and posted on simplemachines.org.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Help: How to call a SSI.php function within a customized php block?
« Reply #7 on: September 22, 2010, 09:14:51 AM »
Please see http://simpleportal.net/index.php?topic=5332.0
 
You can actually use the calenderInformation block within your tab.
If you are interested, please start a new thread.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline wjhdiz

  • Semi Newbie
  • *
  • Posts: 29
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: Help: How to call a SSI.php function within a customized php block?
« Reply #8 on: September 24, 2010, 11:47:18 PM »
Hi Angelina,

I followed the link and then called sp_calendarInformation(array('events' => 1, 'holidays' => 1, 'future' => 15), 0) and it turned out great.

Thank you so much.