I have this code, it s a wordpress MU code. The result is a string list of blogs subdomains, on a MU domain.

$blogs = get_last_updated();
echo 'Most active mommies:<ul>';
foreach ($blogs AS $blog) {
    echo '<li>'.$blog['domain'].'</li>';
}
echo '</ul>';

I want that instead of the unclickable subdomains, to get a list of clickable subdomains. I want to make them links. I have tried even just to link all of them to the same page using <a href="test">echo '<li>'.$blog.'</li>';</a> or <a href="test"> '<li>'.$blog.'</li>'</a> etc, but it seems i can't. In fact, i have even tried just to input under that code a link like this <a href="Test">test</a>. Even insterting that gives an error.

Does someone know what is the solution? I have already lost 2 hours surfing the web for answers, it seems i am too stupid to find them.

Thank you
Stefan

Recommended Answers

All 3 Replies

You can just simply echo the links? I don't understand what can possibly go wrong?

$blogs = get_last_updated();
echo 'Most active mommies:';
echo '<ul>';
foreach ($blogs AS $blog) {
    echo "<li><a href=\"".$blog['domain']."\">".$blog['domain']."</a></li>";
}
echo '</ul>';

Thank you, i will try it in the morning, since i think i have several beers above the working limit :) Kalabunga

You can just simply echo the links? I don't understand what can possibly go wrong?

$blogs = get_last_updated();
echo 'Most active mommies:';
echo '<ul>';
foreach ($blogs AS $blog) {
    echo "<li><a href=\"".$blog['domain']."\">".$blog['domain']."</a></li>";
}
echo '</ul>';

That code is not working, but this one does:

$blogs = get_last_updated();
echo 'Most active mommies:';
echo '<ul>';
foreach ($blogs AS $blog) {
    echo '<li>','<a href="http://www.'.$blog['domain'].'">'.$blog['domain'].'</a>','</li>';
}
echo '</ul>';

It seems that ' and , are very important in php :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.