News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

XSSI - SSI.php XML Connector

Started by Lord Gnu, May 13, 2007, 11:45:55 AM

Previous topic - Next topic

Lord Gnu

Link to Mod

Allows communication with the forum through XML data instead of data sent between PHP files.

Originally created to allow Flash to communicate with SMF via XML.

See examples at hxxp:www.bauerbox.com/forums/xssi_examples.php [nonactive]

Daniel15

Awesome, great work. This is definitely a useful mod, and I can see heaps of uses for it :D.

Just one little suggestion I have: Code like this:

if (isset($_GET['num_recent']))
{
$num_recent = intval($_GET['num_recent']);
} else {
$num_recent = 8;
}
if(isset($num_recent) && $num_recent < 1)
{
$num_recent = 8;
}
if (isset($_GET['exclude_boards']))
{
$exclude_boards = intval($_GET['exclude_boards']);
} else {
$exclude_boards = null;
}

Can be simplified by using ternary operators ( ?: ):

$num_recent = (isset($_GET['num_recent']) && $_GET['num_recent'] > 1) ? intval($_GET['num_recent']) : 8;
$exclude_boards = (isset($_GET['exclude_boards'])) ? intval($_GET['exclude_boards']) : null;


Basically, ternary operators work like this:
(conditional statement) ? what to do if it's true : what to do if it's false
So, in the case of the $exclude_boards variable above, it's:
$exclude_boards = (isset($_GET['exclude_boards'])) ? intval($_GET['exclude_boards']) : null;
Essentially, it's an if statement in a single line ;)

This is just a minor thing, and it depends on what type of coder you are (some coders hate the ternary operators... I love them if they're used correctly :D).
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Advertisement: