News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Expert SSI FAQ

Started by Tomer, June 28, 2004, 07:31:34 PM

Previous topic - Next topic

Sarge

Quote from: Gantry on March 03, 2008, 11:45:27 AM
I would like to prevent the output of any of the SSI functions as a link, instead just a plain text result.

You can simply call the SSI function with the last parameter different from 'echo' and it will simply return the results as an array instead of displaying them. Then you can format the results and display them the way you want:
Make SSI functions return the results instead of displaying them.

Let us know if you need more information.

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

Gantry

Ah, I didn't find that one in my search... thanks Sarge!

Darkness_

when I use this code from the begin post
<?php

$ssi_gzip 
false;
$ssi_ban true;
$ssi_theme '2';
$ssi_layers = array('main');

ob_start();

require(
"/SSI.php");

?>


i get this error at the place of a button I made (it's a button for another page I made, its olmost the same as of the index.template in the theme end index.php in the sources, only e little difference) button name is lounge

      Notice: Use of undefined constant Lounge - assumed 'Lounge' in /mnt/web1/42/36/51651736/htdocs/forum/Sources/Load.php(1731) : eval()'d code on line 439
      Lounge


fwitt

the most likely cause of that error is that somewhere you have entered the word Lounge without quotes to show its a string not a variable.

so

echo Lounge;


instead of


echo 'Lounge';

aldo

Cool, this is why I love SMF, from what I am aware of, no other forum system has a prebuilt SSI file like SMF.

Not sure if this has been mentioned, but if you put this in a PHP file you can view a lot more of SMF's SSI variables and such you can use:

<?php
require("{PATH_TO_FORUM}/SSI.php");
echo 
'<pre>';
print_r($GLOBALS);
echo 
'</pre>';
?>


Be aware! That in that file, it will show your MySQL connection info, like your MySQL User pass, DB, and User, so don't let anyone you don't want to see it, um, see it ;)

Darkness_

how can we give these functions a class?

a little explanation what I'm meaning

I want to use this ss function


ssi_recentPosts($num_recent = 8, $exclude_boards = null, $output_method = 'echo')


But I want to give it a class (windowbg, catbg things like that)
the place where I want it, en the heigts and weight?

I hope someone will get what I mean

fwitt

it already has the class ssi_table, just add that to your css with the atributes required

Darkness_

#107
but how can I change the pictures widthness and things like that, for every different ssi function?

metallica48423

look into using the 'array' output rather than 'echo' you could apply your own HTML/PHP mix.  Look at the functions and look how they echo when the last parameter is set to echo

I do believe that is covered in one of the SSI faqs.  If you use the function DB off the support section of this site, you can see what attributes are expected.  If you look at the SSI function itself in SSI.php, you can see how it references the data bits -- usually with $row['row_title'].

Its a learning curve a bit but it can lead to some interesting uses of SSI.
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Darkness_

do you maybe have any example of what you mean?
I don't really get what you mean

metallica48423


                $topics = ssi_RecentTopics('6', array(1,5,21,24,14), '',  'array');
                foreach ($topics as $topic)
                        echo '<b><a href="', $topic['href'], '">', $topic['subject'], '</a></b>';


Sort of basic example.

Basically, It calls the 6 last updated topics that the member can view, excluding the boards in the array, and saves the result as an array in $topics.

the foreach will go through each element in $topics recursively (there would be 6 instances in this case), and its keys will be saved to $topic['key']

The next line is what is looped. 

If you were to put echo '<pre>', print_r($topics), '</pre>'; above the foreach line, it should output each value for $topic.  By doing that I know i can use $topic['subject'] to represent the subject and $topic['href'] to be the link to the topic.

The result? (this is taken from my site)


<b><a href="http://www.zentendo.com/forums/index.php?topic=5325.msg80919;topicseen#new">What's your favorite Zelda game? And</a></b>
<b><a href="http://www.zentendo.com/forums/index.php?topic=5417.msg80917;topicseen#new">Iwata Asks: Link's "Bowgun" Training</a></b>
<b><a href="http://www.zentendo.com/forums/index.php?topic=5418.msg80916;topicseen#new">Crosswords DS - free</a></b>
<b><a href="http://www.zentendo.com/forums/index.php?topic=5422.msg80907;topicseen#new">Two New Games Added to Virtual Console</a></b>
<b><a href="http://www.zentendo.com/forums/index.php?topic=5414.msg80901;topicseen#new">Rygar delayed to 2009</a></b>
<b><a href="http://www.zentendo.com/forums/index.php?topic=4432.msg80900;topicseen#new">The Unofficial ZREO Podcast</a></b>
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Darkness_

#111
can I give them a class to?

like windowbg? or something?

or can it be so that the page has 2 sides en that I place something at the left en something at te right?

metallica48423

you can do any html.  That is just one example.  The array method will just turn the data into variables you can use, which is what i've done.

you do need some php knowledge for this too though
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Darkness_

Ok, thanks I hope I will get along with this.
If I have any questions further can I maybe PM you ?

metallica48423

you can post here -- it'll show up in my unreads :)
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Darkness_


metallica48423

Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Darkness_

#117
<?php {
echo 
'
<div width="50%" align="left">
<table width="50%" class="tborder" style="margin-bottom: 1ex cellspacing="1" cellpadding="4";">
<tr class="catbg" align="center">
<td>'
$txt['test'], '</td>
</tr>'
;
$topics ssi_recentPosts($num_recent 8$exclude_boards null$output_method 'array');
                foreach (
$topics as $topic)

                        echo 
'
<td valign="middle" align="center">
<table border="0" cellpadding="0" cellspacing="0">
<b><a href="'
$topic['href'], '">'$topic['subject'], '</a></b></div>';
}


?>

<?php {
echo 
'
<div width="50%" align="right">
<table width="50%" class="tborder" style="margin-bottom: 1ex cellspacing="1" cellpadding="4";">
<tr class="catbg" align="center">
<td>'
$txt['test'], '</td>
</tr>'
;
ssi_showPoll($topic 13$output_method 'echo');
      

                        echo 
'
<td valign="middle" align="center">
<table border="0" cellpadding="0" cellspacing="0">
<b><a href="'
$topic['href'], '">'$topic['subject'], '</a></b></div>';
}


?>


The First part is looking ok to me, the second part to but it's not how I want to be
I try to get the "echo" to "array" but then I can't see the poll
and another problem is The first part I want to get it on te left side of the page and the other on iets right side.
But when I save the codes like this, the second part gets in to the table of the firt one

Black_Paolo

Really interesting faq :D
But you can't use sth like:
"If you aren't in group 12, so don't show the page you searched but the login one"?
Without using else..
So you can place this code at the top of the page and you don't have to include anything..
So you don't have to do:
if xxx
You can't
else
all the code
close the }
etc..
I'm an Italian boy, so I don't speak English very well.
If there are any errors in my post, please let me know, so I (hopefully) won't do it again :D

shadownexusruler

i have a question is there a way to pull my forums login in to an tabled layout of my hompage is there a way to add these two things
<?php ssi_login(); ?>
Username:     
Password:     
   
Log Out Function: <?php ssi_logout(); ?> and
Board Stats: <?php ssi_boardStats(); ?>
Total Members: 7
Total Posts: 59
Total Topics: 38
Total Categories: 4
Total Boards: 22

Advertisement: