Hi,
clicking on the "About me" button on the user's front page, displays the user's information on one column only.
Is there a way to display on two columns or more, like in the attached file ?
We've found it's in relation with class="cModule cProfile-About app-box" but we don't know how to do it.
How can it be achieved ?
Cheers,
L
Hi.
Interesting... I'll try to prepare a snippet in spare time.
I'll update this thread when I'll have solution ;)
Hi.
Yes, it can be done :) here is solution for 3 columns:
Copy this file:
ROOT/components/com_community/templates/default/profile.about.php
to:
ROOT/templates/your-template/html/com_community (if you don't have "html" or "com_community" folders, feel free to create them)
Replace this (from line 16 to 110):
<div class="app-box-content">
<?php
foreach ($profile['fields'] as $groupName => $items) {
// Gather display data for the group. If there is no data, we can
// later completely hide the whole segment
$hasData = false;
ob_start();
?>
<div class="cField">
<?php if ($groupName != 'ungrouped') { ?>
<h3 class="cField-Title cResetH"><?php echo JText::_($groupName); ?></h3>
<?php } ?>
<ul class="cField-List cResetList">
<?php foreach ($items as $item) { ?>
<?php
if (CPrivacy::isAccessAllowed($my->id, $profile['id'], 'custom', $item['access'])) {
// There is some displayable data here
$hasData = $hasData || CProfileLibrary::getFieldData($item) != '';
?>
<?php
$fieldData = CProfileLibrary::getFieldData($item);
// Escape unless it is URL type, since URL type is in HTML format
if ($item['type'] != 'url' && $item['type'] != 'email' && $item['type'] != 'list' && $item['type'] != 'checkbox') {
$fieldData = $this->escape($fieldData);
}
// If textarea, we need to support multiline entry
if ($item['type'] == 'textarea') {
$fieldData = nl2br($fieldData);
}
if (!empty($fieldData)) {
?>
<li>
<h3 class="cField-Name cResetH"><?php echo JText::_($item['name']); ?></h3>
<?php if (!empty($item['searchLink']) && is_array($item['searchLink'])) { ?>
<div class="cField-Content">
<?php
foreach ($item['searchLink'] as $linkKey => $linkValue) {
$item['value'] = $linkKey;
if ($item['type'] == 'checkbox') {
echo '<a href="' . $linkValue . '">' . $item['value'] . '</a><br />';
} else {
echo '<a href="' . $linkValue . '">' . $fieldData . '</a><br />';
}
}
?>
</div>
<?php } else { ?>
<div class="cField-Content">
<?php echo (!empty($item['searchLink'])) ? '<a href="' . $item['searchLink'] . '"> ' . $fieldData . ' </a>' : $fieldData; ?>
</div>
<?php } ?>
</li>
<?php
}
}
?>
<?php } ?>
</ul>
</div>
<?php
$html = ob_get_contents();
ob_end_clean();
// We would only display the profile data in the group if there is actually some
// data to be displayed
if ($hasData) {
echo $html;
$noData = false;
}
}
if ($noData) {
if ($isMine) {
?>
<div class="cEmpty">
<?php echo JText::_('COM_COMMUNITY_PROFILES_SHARE_ABOUT_YOURSELF'); ?>
</div>
<?php
} else {
?>
<div class="cEmpty">
<?php echo JText::_('COM_COMMUNITY_PROFILES_NO_INFORMATION_SHARE'); ?>
</div>
<?php
}
}
?>
</div><div class="app-box-content">
<?php $ilosc = count($profile['fields']); ?>
<?php $i=0;
foreach ($profile['fields'] as $groupName => $items) {
// Gather display data for the group. If there is no data, we can
// later completely hide the whole segment
$hasData = false;
ob_start();
?>
<?php
$m++;
$n++;
?>
<?php
if ($m==1) {
echo '<div class="row-fluid">';
}
?>
<div class="span4">
<div class="cField">
<?php if ($groupName != 'ungrouped') { ?>
<h3 class="cField-Title cResetH"><?php echo JText::_($groupName); ?></h3>
<?php } ?>
<ul class="cField-List cResetList">
<?php foreach ($items as $item) { ?>
<?php
if (CPrivacy::isAccessAllowed($my->id, $profile['id'], 'custom', $item['access'])) {
// There is some displayable data here
$hasData = $hasData || CProfileLibrary::getFieldData($item) != '';
?>
<?php
$fieldData = CProfileLibrary::getFieldData($item);
// Escape unless it is URL type, since URL type is in HTML format
if ($item['type'] != 'url' && $item['type'] != 'email' && $item['type'] != 'list' && $item['type'] != 'checkbox') {
$fieldData = $this->escape($fieldData);
}
// If textarea, we need to support multiline entry
if ($item['type'] == 'textarea') {
$fieldData = nl2br($fieldData);
}
if (!empty($fieldData)) {
?>
<li>
<h3 class="cField-Name cResetH"><?php echo JText::_($item['name']); ?></h3>
<?php if (!empty($item['searchLink']) && is_array($item['searchLink'])) { ?>
<div class="cField-Content">
<?php
foreach ($item['searchLink'] as $linkKey => $linkValue) {
$item['value'] = $linkKey;
if ($item['type'] == 'checkbox') {
echo '<a href="' . $linkValue . '">' . $item['value'] . '</a><br />';
} else {
echo '<a href="' . $linkValue . '">' . $fieldData . '</a><br />';
}
}
?>
</div>
<?php } else { ?>
<div class="cField-Content">
<?php echo (!empty($item['searchLink'])) ? '<a href="' . $item['searchLink'] . '"> ' . $fieldData . ' </a>' : $fieldData; ?>
</div>
<?php } ?>
</li>
<?php
}
}
?>
<?php } ?>
</ul>
</div>
</div>
<?php
if ($m==3) {
echo '</div>';
$m=0;
}
if ($n==$ilosc) {
echo '</div>';
}
?>
<?php
$html = ob_get_contents();
ob_end_clean();
// We would only display the profile data in the group if there is actually some
// data to be displayed
if ($hasData) {
echo $html;
$noData = false;
}
}
if ($noData) {
if ($isMine) {
?>
<div class="cEmpty">
<?php echo JText::_('COM_COMMUNITY_PROFILES_SHARE_ABOUT_YOURSELF'); ?>
</div>
<?php
} else {
?>
<div class="cEmpty">
<?php echo JText::_('COM_COMMUNITY_PROFILES_NO_INFORMATION_SHARE'); ?>
</div>
<?php
}
}
?>
</div>
Hi.
It works 100% :)
I just applied my demo file for you and it look as expected:
prntscr.com/4mzzcf
(I did it by template override).
Hi,
it's confusing because we've modified by hand as you said file profile.about.php.
And in the demo, file is frontpage.guest.php. So which one is the good one ?
Cheers,
L
Hi.
frontpage.guest.php was my mistake, zip should contain profile.about.php.
Code is fine as other user confirmed it works for him. And it's exact copy from my file.
You probably missed something - I haven't review your code, just applied my demo file ;)
Hi,
we've just copied the file from the override ROOT/templates/Socialize/html/com_community/profile.about.php
to our other site test. We still have the 2 columns on the first row. Can't figure out what's wrong.
Even after clearing the cache. It's a mystery
Cheers,
L
HI.
But on live site everything is ok?
What is the link to dev site? Will FTP access for your main site work for dev site as well?
hi,
you're right.
But we just want to understand why not on our other site.
Just in case we've updated the credential info in the ticket, in order to access to it.
cheers,
L
HI.
That is strange indeed.
For some reason first columns has value 2 instead of 1. This first element displayed so it HAS to have 1... it just look like forst columnt was blank and counting starts from 2 not 1...
I'm not sure what cause that...