Jump to content

Extracting data from string (I guess)


soltek

Recommended Posts

Hey guys, I'm trying to customize the look of a script, but I'm having issues extracting the output of a string - I think that's a string.

 

This is the the code the function/string:

 

	function notice(){
	printf($this->lang['notice'],Tools_get::convert_time($this->ttl*60),$this->limitPERIP,Tools_get::convert_time($this->ttl_ip*60));
	$this->CheckMBIP();
	$MB1IP = Tools_get::convertmb($this->countMBIP*1024*1024);
	$thislimitMBIP = Tools_get::convertmb($this->limitMBIP*1024*1024);
	$maxsize =  Tools_get::convertmb($this->max_size_other_host*1024*1024);

	printf($this->lang['yourjobs'],$_SERVER['REMOTE_ADDR'],$this->lookup_ip($_SERVER['REMOTE_ADDR']),$this->max_jobs_per_ip,$MB1IP,$thislimitMBIP);

	printf($this->lang['status'],$maxsize,count($this->jobs),$this->max_jobs,$this->get_load(),$this->max_load,Tools_get::useronline());
}

 

And this is the code on the footer that display the IP address, maximum jobs and stuff:

<?php echo $obj->notice();?>

 

This last line prints everything I need on the page, but I wanted to put them inside <span>s, to I tried to do something like:

 

<span><?php echo <?php echo $config->lang['yourjobs'] ?></span>

But it doesn't work.

 

Can you give me hand please?

Link to comment
Share on other sites

Better yet, put your <span> tags right in the notice() function:

 

 

printf($this->lang['notice'],Tools_get::convert_time($this->ttl*60),$this->limitPERIP,Tools_get::convert_time($this->ttl_ip*60));

Becomes:

 

printf('<span>' . $this->lang['notice'] . '</span>',Tools_get::convert_time($this->ttl*60),$this->limitPERIP,Tools_get::convert_time($this->ttl_ip*60));

 

Link to comment
Share on other sites

You really should take a second look at the last line of code you posted too, and turn on error handling: You have quite a few errors in that bit, and it shows a lack of understanding on how PHP actually works. Either that, or it's a copy-pasta error, and you didn't pay enough attention to your code.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.