Jump to content

How can I put this code into a variable?


Monkuar

Recommended Posts

I have a option in my profile settings for users to beable to "hide" there friends list

 

this si my code to show there friends on there profile

 

$this->to_print .= <<< LOL
<fieldset><legend>$Friends</legend>
<div class="padding4">
$Friends2
LOL;
while( $r = $DB->fetch_row() ){





		   if ( $r['last_activity'] > (time() - 900) )
$r['status'] = "<span style=float:right;><span class=desc4><b>Online</b></span></span>";
		else
$r['status'] = "<span style=float:right;><span class=desc4>Offline</span></span>";
		   $column++;
		   if ($ibforums->member['settings']['2'] or (!$ibforums->member['id'])){
		   $color  = "{$r['color']}";
$colors = explode(",", $color);
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ){
    {
$r['color'] = ($r['color']) ? "style=\"padding:1px 1px 1px 2px;color:#{$colors[0]};filter:Glow(color=#{$colors[1]},strength=3)\"":"";
    }
}else{
$r['color'] = ($r['color']) ? "style=\"color:#{$colors[0]};text-shadow:#{$colors[1]} 2px 1px 1px\"":"";
}
}
$test = explode(";", $info['pdata']);
$r['avatar'] = ($r['avatar']) ? "<img src={$r['avatar']} width=64 height=64>" : "";
		   $r['star'] = ($r['star']) ? "<img class=top3 src=style_images/1/icons/{$r['star']}.png>":"";
		   
$r['name'] = "<a href=?i={$r['friendid']}>{$r['name']}{$r['star']}</a>";


	  $this->to_print .= <<< LOL
<dl class="LOL LEFT flm" style="margin-right:5px"><dt2>{$r['name']}</dt2><dd class=padding4>{$r['avatar']}<div class="RIGHT">{$r['status']}</div></dd></dl>
LOL;
	   }
$this->to_print .= <<< LOL


</div>
</fieldset>

 

 

now I will be using this code to make it hidden based on a variable (they set in there settings)

 

//Hide Friends
if ($display[0] == "1"){
$friend = "";
}else{
$friend = 'show that function here above code';
}

 

 

 

how can I pull all that info into my $friend variable to make it easy?

 

See then I could just echo out $friend and it will show that code above, or not (if they hidden it in settings)?

 

Help ty

Link to comment
Share on other sites

OKay update:I got it into my $friends variable!

 

 

$friends = 
$this->to_print .= <<< LOL
<fieldset><legend>$Friends</legend>
<div class="padding4">
$Friends2
LOL;
while( $r = $DB->fetch_row() ){





		   if ( $r['last_activity'] > (time() - 900) )
$r['status'] = "<span style=float:right;><span class=desc4><b>Online</b></span></span>";
		else
$r['status'] = "<span style=float:right;><span class=desc4>Offline</span></span>";
		   $column++;
		   if ($ibforums->member['settings']['2'] or (!$ibforums->member['id'])){
		   $color  = "{$r['color']}";
$colors = explode(",", $color);
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ){
    {
$r['color'] = ($r['color']) ? "style=\"padding:1px 1px 1px 2px;color:#{$colors[0]};filter:Glow(color=#{$colors[1]},strength=3)\"":"";
    }
}else{
$r['color'] = ($r['color']) ? "style=\"color:#{$colors[0]};text-shadow:#{$colors[1]} 2px 1px 1px\"":"";
}
}
$test = explode(";", $info['pdata']);
$r['avatar'] = ($r['avatar']) ? "<img src={$r['avatar']} width=64 height=64>" : "";
		   $r['star'] = ($r['star']) ? "<img class=top3 src=style_images/1/icons/{$r['star']}.png>":"";
		   
$r['name'] = "<a href=?i={$r['friendid']}>{$r['name']}{$r['star']}</a>";


	  $this->to_print .= <<< LOL
<dl class="LOL LEFT flm" style="margin-right:5px"><dt2>{$r['name']}</dt2><dd class=padding4>{$r['avatar']}<div class="RIGHT">{$r['status']}</div></dd></dl>
LOL;
	   }
$this->to_print .= <<< LOL


</div>
</fieldset>
LOL;

 

But I can't call my $friends variable anywhere?  ::)

Link to comment
Share on other sites

HAHAA I FIXED IT!!!

 

TOPIC RESOLVED!!!

 

if ($display[0] == "1"){
$f = "";
}else{
while( $r = $DB->fetch_row() ){
		   if ( $r['last_activity'] > (time() - 900) )
$r['status'] = "<span style=float:right;><span class=desc4><b>Online</b></span></span>";
		else
$r['status'] = "<span style=float:right;><span class=desc4>Offline</span></span>";
		   $column++;
		   if ($ibforums->member['settings']['2'] or (!$ibforums->member['id'])){
		   $color  = "{$r['color']}";
$colors = explode(",", $color);
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ){
    {
$r['color'] = ($r['color']) ? "style=\"padding:1px 1px 1px 2px;color:#{$colors[0]};filter:Glow(color=#{$colors[1]},strength=3)\"":"";
    }
}else{
$r['color'] = ($r['color']) ? "style=\"color:#{$colors[0]};text-shadow:#{$colors[1]} 2px 1px 1px\"":"";
}
}
$test = explode(";", $info['pdata']);
$r['avatar'] = ($r['avatar']) ? "<img src={$r['avatar']} width=64 height=64>" : "";
		   $r['star'] = ($r['star']) ? "<img class=top3 src=style_images/1/icons/{$r['star']}.png>":"";
		   
$r['name'] = "<a href=?i={$r['friendid']}>{$r['name']}{$r['star']}</a>";


	  $friendoutput .= <<< LOL
<dl class="LOL LEFT flm" style="margin-right:5px"><dt2>{$r['name']}</dt2><dd class=padding4>{$r['avatar']}<div class="RIGHT">{$r['status']}</div></dd></dl>
LOL;
	   }
$f = '<fieldset><legend>'.$Friends.'</legend>
<div class="padding4">
'.$Friends2.'
'.$friendoutput.'

</div>
</fieldset>';
}

 

so epic

 

didn't know .= passes a LOOP! <333333333333333333333333333

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.