Trying to figure out how to display a freeform list with links corresponding to each line (or CSV).
We've been talking about it on http://drupal.org/node/14466 .
Drupal is doing it, so why can't we? ... using phptemplate, successfully overriding the user profile template...
Here's what's been tried, note that profile_employer and profile_profession are both names of profile fields specified in the user/profiles admin area, as freeform lists -
<?php if($user->profile_employer): ?>
<div class="user_employer">
<a href="/profile/profile_employer/<?php print $user->profile_employer ?>"><?php print $user->profile_employer ?></a>
<?php endif; ?>
(this creates a link that includes all of the contents into one big link)
<?php if ($user->profile_profession !=""):?>
<div class="user_profession">
<? print $user->profile_profession ?>
<ul>
<?php foreach ($user->profile_profession as $profession_link):?>
<li><a href="/profile/profile_profession/<? print $profession_link ?>" title="title here"><? print $profession_link ?></a></li>
<?php endforeach ?>
</ul>
</div>
<?php endif ?>
(the first print inside the if statement here was for debugging purposes, it works, just outputs the text, on one line)
$count_total = count($user->profile_profession);
for ($counter=0; $counter<$count_total; $counter++)
{
$line = each ($user->profile_profession);
<li><a href="/profile/profile_profession/<? print $line ?>" title="title here"><? print $line ?></a></li>";
}
(this was modified a little to either print the list item line or to contain it within for /endfor, nothing worked)
I've been working on this for a few days now and I'm a bit confused. There have been two errors reported in the site log,
warning: Invalid argument supplied for foreach() in /"my account path"/public_html/themes/griffin_phptemplate/user_profile.tpl.php on line 22.
(for the foreach statement try)
warning: Variable passed to each() is not an array or object in /"my path"/public_html/themes/griffin_phptemplate/user_profile.tpl.php on line 22.
(for the each statement try)