SimplePortal

Customization => Custom Coding => Topic started by: prawn185 on May 07, 2015, 04:37:24 AM

Title: Linking to an custom Index.html
Post by: prawn185 on May 07, 2015, 04:37:24 AM
I want to bebale to link the block where you see the recent post from 'announcements' to my index.html with I made
Title: Re: Linking to an custom Index.html
Post by: ♦ Ninja ZX-10RR ♦ on May 07, 2015, 08:38:03 AM
Hi! Welcome to SimplePortal.
The code you have to call into your html page is this:
Code: [Select]
<?php
function sp_recent($parameters$id$return_parameters false)
{
global $txt$scripturl$settings$context$color_profile;

$block_parameters = array(
'boards' => 'boards',
'limit' => 'int',
'type' => 'select',
'display' => 'select',
);

if ($return_parameters)
return $block_parameters;

$boards = !empty($parameters['boards']) ? explode('|'$parameters['boards']) : null;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$type 'ssi_recent' . (empty($parameters['type']) ? 'Posts' 'Topics');
$display = empty($parameters['display']) ? 'compact' 'full';

$items $type($limitnull$boards'array');

if (empty($items))
{
echo '
'
$txt['error_sp_no_posts_found'];
return;
}
else
$items[count($items) - 1]['is_last'] = true;

$colorids = array();
foreach ($items as $item)
$colorids[] = $item['poster']['id'];

if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
foreach ($items as $k => $p)
{
if (!empty($color_profile[$p['poster']['id']]['link']))
$items[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];
}
}

if ($display == 'compact')
{
foreach ($items as $key => $item)
echo '
<a href="'
$item['href'], '">'$item['subject'], '</a> <span class="smalltext">'$txt['by'], ' '$item['poster']['link'], $item['new'] ? '' ' <a href="' $scripturl '?topic=' $item['topic'] . '.msg' $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' $settings['lang_images_url'] . '/new.gif" alt="' $txt['new'] . '" border="0" /></a>''<br />['$item['time'], ']</span><br />', empty($item['is_last']) ? '<hr />' '';
}
elseif ($display == 'full')
{
echo '
<table class="sp_fullwidth">'
;

foreach ($items as $item)
echo '
<tr>
<td class="sp_recent_icon sp_center">
'
sp_embed_image(empty($parameters['type']) ? 'post' 'topic'), '
</td>
<td class="sp_recent_subject">
<a href="'
$item['href'], '">'$item['subject'], '</a>
'
$item['new'] ? '' '<a href="' $scripturl '?topic=' $item['topic'] . '.msg' $item['new_from'] . ';topicseen#new"><img src="' $settings['images_url'] . '/' $context['user']['language'] . '/new.gif" alt="' $txt['new'] . '" border="0" /></a>''<br />['$item['board']['link'], ']
</td>
<td class="sp_recent_info sp_right">
'
$item['poster']['link'], '<br />'$item['time'], '
</td>
</tr>'
;

echo '
</table>'
;
}
}
?>

At least if I understood your question correctly, but I am not completely sure about it, it's not very clear.

Regards
Title: Re: Linking to an custom Index.html
Post by: prawn185 on May 07, 2015, 09:46:21 AM
Ok thanks ill give it a go and get back to you :)
Title: Re: Linking to an custom Index.html
Post by: ♦ Ninja ZX-10RR ♦ on May 07, 2015, 11:24:27 AM
Sure! Let me know :)
Title: Re: Linking to an custom Index.html
Post by: prawn185 on May 07, 2015, 09:58:17 PM
I cant seem to get it to work:
Code: [Select]
<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Army Storm Gaming</title>
    <link rel="stylesheet" href="styles.css" type="text/css" />
</head>
<body>
<div id="container">
    <header>
<img class="header-image" src="http://i1.ytimg.com/vi/m2Z1ftAqCZ8/maxresdefault.jpg" alt="Header" />
    </header>
    <nav>
    <ul>
        <li class="start selected"><a href="index.php">Home</a></li>
<li><a href="about.html">About us!</a></li>
            <li><a href="application.html">Want to join Cops/medics?</a></li>
            <li><a href="donate.html">Donate Here!</a></li>
            <li><a href="forum/index.php">Forums</a></li>
        </ul>
    </nav>


    <div id="body">

<section id="content">

<?php
function sp_recent($parameters$id$return_parameters false)
{
global $txt$scripturl$settings$context$color_profile;

$block_parameters = array(
'boards' => 'boards',
'limit' => 'int',
'type' => 'select',
'display' => 'select',
);

if ($return_parameters)
return $block_parameters;

$boards = !empty($parameters['boards']) ? explode('|'$parameters['boards']) : null;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$type 'ssi_recent' . (empty($parameters['type']) ? 'Posts' 'Topics');
$display = empty($parameters['display']) ? 'compact' 'full';

$items $type($limitnull$boards'array');

if (empty($items))
{
echo '
'
$txt['error_sp_no_posts_found'];
return;
}
else
$items[count($items) - 1]['is_last'] = true;

$colorids = array();
foreach ($items as $item)
$colorids[] = $item['poster']['id'];

if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
foreach ($items as $k => $p)
{
if (!empty($color_profile[$p['poster']['id']]['link']))
$items[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];
}
}

if ($display == 'compact')
{
foreach ($items as $key => $item)
echo '
<a href="'
$item['href'], '">'$item['subject'], '</a> <span class="smalltext">'$txt['by'], ' '$item['poster']['link'], $item['new'] ? '' ' <a href="' $scripturl '?topic=' $item['topic'] . '.msg' $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' $settings['lang_images_url'] . '/new.gif" alt="' $txt['new'] . '" border="0" /></a>''<br />['$item['time'], ']</span><br />', empty($item['is_last']) ? '<hr />' '';
}
elseif ($display == 'full')
{
echo '
<table class="sp_fullwidth">'
;

foreach ($items as $item)
echo '
<tr>
<td class="sp_recent_icon sp_center">
'
sp_embed_image(empty($parameters['type']) ? 'post' 'topic'), '
</td>
<td class="sp_recent_subject">
<a href="'
$item['href'], '">'$item['subject'], '</a>
'
$item['new'] ? '' '<a href="' $scripturl '?topic=' $item['topic'] . '.msg' $item['new_from'] . ';topicseen#new"><img src="' $settings['images_url'] . '/' $context['user']['language'] . '/new.gif" alt="' $txt['new'] . '" border="0" /></a>''<br />['$item['board']['link'], ']
</td>
<td class="sp_recent_info sp_right">
'
$item['poster']['link'], '<br />'$item['time'], '
</td>
</tr>'
;

echo '
</table>'
;
}
}
?>


        </section>
       
        <aside class="sidebar">

            <ul>
               <li>
                    <h4>Our servers and IPs</h4>
                    </div><div class="tab-pane" id="most_wanted">
    <ul class="thumbnails">
    <li class="span3">
        <div class="thumbnail">
            <p class="caption-small">Arma 3 Altis Life: 85.236.100.85:19607</p></a>
        </div>
    </li>
        <li class="span3">
        <div class="thumbnail">
            <p class="caption-small">Rust</p></a>
        </div>
    </li>
        <li class="span3">
        <div class="thumbnail">
            <p class="caption-small">Teamspeak</p></a>
        </div>
    </li>
        <li class="span3">
        <div class="thumbnail">
            <p class="caption-small">NULL</p></a>
        </div>
    </li>
    </ul>

<!-- Footer -->
        </aside>
    <div class="clear"></div>
    </div>
    <footer>
        <div class="footer-content">
            <ul>
            <li><h4>Quick links</h4></li>
<li><a href="index.php">Home</a></li>
                <li><a href="forum/index.php">Forums</a></li>
                <li><a href="apply.html">Want to be Police?</a></li>
                <li><a href="apply.html">Want to be Medic?</a></li>
            </ul>
           
           
            <div class="clear"></div>
        </div>
        <div class="footer-bottom">
            <p>&copy; 2015-2016 Shaun Moore<p>
         </div>
    </footer>
<!-- End of Footer -->
</div>
</body>
</html>
Title: Re: Linking to an custom Index.html
Post by: ♦ Ninja ZX-10RR ♦ on June 22, 2015, 08:29:07 AM
Not sure why but it never notified me of your reply :/ Did you set the block to be HTML and not PHP? Because you have php inside html.
SimplePortal 2.3.8 © 2008-2024, SimplePortal