By m4ssiv3 on
First of all im new to drupal and php , so here is what i want to edit....
print "<div class=\"fields\">";
print "User is ";
$time_period = variable_get('user_block_seconds_online', 2700);
$uid = arg(1); // get the current userid that is being viewed.
$users = db_query('SELECT DISTINCT(uid), MAX(timestamp) AS max_timestamp FROM {sessions} WHERE timestamp >= %d AND uid = %u GROUP BY uid ORDER BY max_timestamp DESC', time() - $time_period, $uid);
$total_users = db_num_rows($users);
if ($total_users == 1) {
$output = t('online'); <-------------- this the word online to appear Green
}
else {
$output = t('offline'); <---------------and this offline to appear red
}
print $output;
print "</div>";
===================================
===================================
also how can i have left and right alignment on the same lines??
This is being written in the user_profile.tpl.php file..
ignore the
> tags
===============
instead of:
<?php
name:
Age:
Company:
Username
_________
l l
l l
l (image) l
l l
-----------
website:
msn:
===============
To Have this...
name: Username
Age: _________
Company: l l
l l
l (image) l
l l
-----------
website: msn:
================
Any help will be much appreciated
Comments
Use CSS classes
i think, if i understand your question correctly, you need to use CSS and style sheets to achieve this. For the first Red/green question, i believe that everything inside the inteverted commas is html so you should be able to change 'online' to
'<span class="green">online</span>'(Sorry - I'm not too familliar with php either. !) You'll then need to add the class 'green' to your style sheet.The second problem can also be solved with style sheets if you wrap the second "column" in a div and float it to the right.
hope that helps
Fixed the first prob
Ok so the first issue is out of the way... 'online' didnt work but it help me understand, thanks..
Still the i have got no where on the second prob... this is what i have done.....
===========
=======
Can anyone help me with this so that the above and only the above load on the right side Inline with the left side..
Study CSS to Show Thyself Approved
You need some in-depth study of CSS before you continue. The following will position everything in the DIV to the right. Should give you a start point at least.
Alternatively, you can add the "float:right;" to your class style ("fields") and just use
Thank you very much,
Thank you very much, problems resolved