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: 218
  • 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]

NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: Html with php code in a block (split)  (Read 7706 times)

0 Members and 1 Guest are viewing this topic.

Offline cieplutki

  • Semi Newbie
  • *
  • Posts: 8
  • Gender: Male
    • ewmapa
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Html with php code in a block (split)
« on: January 03, 2016, 09:56:07 AM »
I have this code
Code: [Select]
<?php
// A PHP comment.

// A function:
function hub()
{
$hub[] = "imperium1.pl:1234" ;
for( $a $a count$hub ) ; $a++ )
{
$ent explode":"$hub[$a] ) ;
$adres $ent[0] ;
$port $ent[1] ;
$fp = @fsockopen($adres$port$errno$errstr5);
if ($fp) {
echo '<img src="http://dcmaniak.com.pl/images/hubon.gif" alt="On-Line" title="HUB ON-Line " border="0" /><br />';
} else {
echo '<img src="http://dcmaniak.com.pl/images/huboff.gif" alt="Off-Line" title="HUB OFF-Line " border="0" /><br />';
}
}
      
// Some HTML
      
echo 'Hub: <b>Imperium</b>';
}
return 
hub();
?>

how to add another

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Html with php code in a block (split)
« Reply #1 on: January 03, 2016, 10:08:26 AM »
Hi, please post your own topics without bumping 7 years old ones.

Can you explain what you need? Your question doesn't tell me anything useful :/

Regards
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline cieplutki

  • Semi Newbie
  • *
  • Posts: 8
  • Gender: Male
    • ewmapa
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Html with php code in a block (split)
« Reply #2 on: January 03, 2016, 01:44:23 PM »
Hello
This code is to show the effect of dc ++ hub
link http://www.dcmaniak.com.pl/index.php?action=forum
code runs on a single hub how to add more using this code block
sorry for my english   :(

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Html with php code in a block (split)
« Reply #3 on: January 03, 2016, 01:51:55 PM »
You need the rest of the code, I cannot invent it ._. Like:
Code: [Select]
<?php
// A PHP comment.

// A function:
function hub()
{
$hub[] = "imperium1.pl:1234" ;
for( $a $a count$hub ) ; $a++ )
{
$ent explode":"$hub[$a] ) ;
$adres $ent[0] ;
$port $ent[1] ;
$fp = @fsockopen($adres$port$errno$errstr5);
if ($fp) {
echo '<img src="http://dcmaniak.com.pl/images/hubon.gif" alt="On-Line" title="HUB ON-Line " border="0" /><br />';
} else {
echo '<img src="http://dcmaniak.com.pl/images/huboff.gif" alt="Off-Line" title="HUB OFF-Line " border="0" /><br />';
}
}
      
// Some HTML
      
echo 'Hub: <b>Imperium</b>';
}
return 
hub();
// Hub2
function hub2()
{
$hub2[] = "whatever:whateverport" ;
for( $a $a count$hub2 ) ; $a++ )
{
$ent explode":"$hub2[$a] ) ;
$adres $ent[0] ;
$port $ent[1] ;
$fp = @fsockopen($adres$port$errno$errstr5);
if ($fp) {
echo '<img src="http://dcmaniak.com.pl/images/hubon.gif" alt="On-Line" title="HUB ON-Line " border="0" /><br />';
} else {
echo '<img src="http://dcmaniak.com.pl/images/huboff.gif" alt="Off-Line" title="HUB OFF-Line " border="0" /><br />';
}
}
      
// Some HTML
      
echo 'Hub: <b>Whatever</b>';
}
return 
hub2();
?>
But like I said you need to replace the code parts with the logic you have for the first hub, I cannot invent that data.
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline cieplutki

  • Semi Newbie
  • *
  • Posts: 8
  • Gender: Male
    • ewmapa
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Html with php code in a block (split)
« Reply #4 on: January 03, 2016, 03:11:07 PM »
have code to second hub, but its not working
I do not know on php please help
Code: [Select]
<?php
function hub()
{
$hub[] = "imperium1.pl:1234" ;
for( $a $a count$hub ) ; $a++ )
{
$ent explode":"$hub[$a] ) ;
$adres $ent[0] ;
$port $ent[1] ;
$fp = @fsockopen($adres$port$errno$errstr5);
if ($fp) {
echo '<img src="http://dcmaniak.com.pl/images/hubon.gif" alt="On-Line" title="HUB ON-Line " border="0" /><br />';
} else {
echo '<img src="http://dcmaniak.com.pl/images/huboff.gif" alt="Off-Line" title="HUB OFF-Line " border="0" /><br />';
}
}
      
// Some HTML
      
echo 'Hub: <b>Imperium</b>';
}
return 
hub();
// Hub2
function hub2()
{
$hub2[] = "ironmaiden.odysejahub.com:1090" ;
for( $a $a count$hub2 ) ; $a++ )
{
$ent explode":"$hub2[$a] ) ;
$adres $ent[0] ;
$port $ent[1] ;
$fp = @fsockopen($adres$port$errno$errstr5);
if ($fp) {
echo '<img src="http://dcmaniak.com.pl/images/hubon.gif" alt="On-Line" title="HUB ON-Line " border="0" /><br />';
} else {
echo '<img src="http://dcmaniak.com.pl/images/huboff.gif" alt="Off-Line" title="HUB OFF-Line " border="0" /><br />';
}
}
      
// Some HTML
      
echo 'Hub: <b>IROM MAIDEN</b>';
}
return 
hub2();
?>

Offline emanuele

  • Developer
  • *
  • Posts: 293
Re: Html with php code in a block (split)
« Reply #5 on: January 03, 2016, 05:48:59 PM »
I would add to the array, but that alone is not enough, so let's change the code a bit and use:
Code: [Select]
<?php
// A PHP comment.

// A function:
function hub()
{
$hub[] = array(
    
"imperium1.pl:1234",
    
'Hub: <b>Imperium</b>'
);
$hub[] = array(
    
"ironmaiden.odysejahub.com:1090",
    
'Hub: <b>IROM MAIDEN</b>'
);

for( $a $a count$hub ) ; $a++ )
{
$ent explode":"$hub[$a][0] ) ;
$adres $ent[0] ;
$port $ent[1] ;
$fp = @fsockopen($adres$port$errno$errstr5);
if ($fp) {
echo '<img src="http://dcmaniak.com.pl/images/hubon.gif" alt="On-Line" title="HUB ON-Line " border="0" /><br />';
} else {
echo '<img src="http://dcmaniak.com.pl/images/huboff.gif" alt="Off-Line" title="HUB OFF-Line " border="0" /><br />';
}
// Some HTML
echo $hub[$a][1];
}
}
return 
hub();
?>
Next time you want to add a new hub, you copy&paste the bit at the beginning and change what you need, for example:
Code: [Select]
function hub()
{
$hub[] = array(
    "imperium1.pl:1234",
    'Hub: <b>Imperium</b>'
);
$hub[] = array(
    "ironmaiden.odysejahub.com:1090",
    'Hub: <b>IROM MAIDEN</b>'
);
$hub[] = array(
    "this.other.hub.com:1234",
    'Hub: <b>Random</b>'
);

Hope it does make sense. ;)

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Html with php code in a block (split)
« Reply #6 on: January 03, 2016, 06:16:12 PM »
Thanks :)
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline cieplutki

  • Semi Newbie
  • *
  • Posts: 8
  • Gender: Male
    • ewmapa
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Html with php code in a block (split)
« Reply #7 on: January 04, 2016, 01:30:04 PM »
almost good
but on Aattach screen
how to add a new row or something similar?
thanks for help

Offline emanuele

  • Developer
  • *
  • Posts: 293
Re: Html with php code in a block (split)
« Reply #8 on: January 04, 2016, 04:07:08 PM »
Are you sure you want to have each of them on a new line?
Wouldn't be nicer to have them aligned on the same line?
Code: [Select]
echo $hub[$a][1];to:
Code: [Select]
echo $hub[$a][1] . '<br />';to have new lines, but I would do something like this:
Code: [Select]
echo '<div class="hubs">' . $hub[$a][1] . '</div>';and then add this to a css file:
Code: [Select]
.hubs {
width: 33%;
    display: inline-block;
    min-width: 10em;
    padding-bottom: 1.5em;
}

Offline cieplutki

  • Semi Newbie
  • *
  • Posts: 8
  • Gender: Male
    • ewmapa
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Html with php code in a block (split)
« Reply #9 on: January 05, 2016, 04:21:15 AM »
great working
thank you

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Html with php code in a block (split)
« Reply #10 on: January 05, 2016, 09:17:00 AM »
I will go ahead and mark it as solved then, feel free to do it yourself next time by hitting the relative button, thanks!

Regards
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis