Main Menu
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 log in.

Who's Online

  • Dot Guests: 1185
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

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]


Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Html with php code in a block (split)

Started by cieplutki, January 03, 2016, 09:56:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cieplutki

I have this code
<?php// A PHP comment.// A function:function hub(){$hub[] = "imperium1.pl:1234" ;	for( $a = 0 ; $a < count( $hub ) ; $a++ )		{		$ent = explode( ":", $hub[$a] ) ;		$adres = $ent[0] ;		$port = $ent[1] ;		$fp = @fsockopen($adres, $port, $errno, $errstr, 5);		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

♦ Ninja ZX-10RR ♦

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

cieplutki

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   :(

♦ Ninja ZX-10RR ♦

You need the rest of the code, I cannot invent it ._. Like:
<?php// A PHP comment.// A function:function hub(){$hub[] = "imperium1.pl:1234" ;	for( $a = 0 ; $a < count( $hub ) ; $a++ )		{		$ent = explode( ":", $hub[$a] ) ;		$adres = $ent[0] ;		$port = $ent[1] ;		$fp = @fsockopen($adres, $port, $errno, $errstr, 5);		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();// Hub2function hub2(){$hub2[] = "whatever:whateverport" ;	for( $a = 0 ; $a < count( $hub2 ) ; $a++ )		{		$ent = explode( ":", $hub2[$a] ) ;		$adres = $ent[0] ;		$port = $ent[1] ;		$fp = @fsockopen($adres, $port, $errno, $errstr, 5);		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

cieplutki

have code to second hub, but its not working
I do not know on php please help
<?phpfunction hub(){$hub[] = "imperium1.pl:1234" ;	for( $a = 0 ; $a < count( $hub ) ; $a++ )		{		$ent = explode( ":", $hub[$a] ) ;		$adres = $ent[0] ;		$port = $ent[1] ;		$fp = @fsockopen($adres, $port, $errno, $errstr, 5);		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();// Hub2function hub2(){$hub2[] = "ironmaiden.odysejahub.com:1090" ;	for( $a = 0 ; $a < count( $hub2 ) ; $a++ )		{		$ent = explode( ":", $hub2[$a] ) ;		$adres = $ent[0] ;		$port = $ent[1] ;		$fp = @fsockopen($adres, $port, $errno, $errstr, 5);		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();?>

emanuele

I would add to the array, but that alone is not enough, so let's change the code a bit and use:
<?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 = 0 ; $a < count( $hub ) ; $a++ )		{		$ent = explode( ":", $hub[$a][0] ) ;		$adres = $ent[0] ;		$port = $ent[1] ;		$fp = @fsockopen($adres, $port, $errno, $errstr, 5);		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:
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. ;)

♦ Ninja ZX-10RR ♦

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

cieplutki

almost good
but on Aattach screen
how to add a new row or something similar?
thanks for help

emanuele

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?
echo $hub[$a][1];
to:
echo $hub[$a][1] . '<br />';
to have new lines, but I would do something like this:
echo '<div class="hubs">' . $hub[$a][1] . '</div>';
and then add this to a css file:
.hubs {
width: 33%;
    display: inline-block;
    min-width: 10em;
    padding-bottom: 1.5em;
}


♦ Ninja ZX-10RR ♦

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