Use Views to create Blogs Table List
CompShack - February 3, 2008 - 05:38
Hi all,
I was planing to have a link on my site called (Blogs) when clicked a page should open that lists all blogs available on the site along with node count. I wanted the page to look like the pages created from the views module as a "table view".
I was surprised to find out that the view module don't have a field that link to user blogs and don't have a node count for each blog. Anyone know how could I accomplish this? I appreciate you help - Thanks!

Any help
Any help on creating such a view?!
-----------------------------------------
Finally, I CMS that I Like!
http://www.CompShack.com
I'm trying to accomplish
I'm trying to accomplish this as well. Tried using views but no luck.
Here is some code!
Here is some code that I wrote to do that. You can see an example on my site http://www.compshack.com/authors
Just create a new "page" type node and past the code in the body, for input formate choose PHP. The code will display the blog name and feed icon. I am getting the post count back but not displaying it (don't want it). The feed icon will not show until you upload the picture to misc/feed.png
<?php$row_color = array('odd','even');
$color_index = 0;
$result = db_query("SELECT u.uid, u.name, COUNT(0) AS num FROM {node} n LEFT JOIN {users} u ON u.uid = n.uid WHERE n.type = 'blog' GROUP BY u.uid, u.name ORDER BY u.name ASC");
print "<table>\n";
print '<tr class="even"><td><a href="/main-blog">Blogs</a> (List posts from all blogs)</td>'; ?>
<td> <a href="main-blog/feed" target = "_blank"> <img src="misc/feed.png"/></a></td></tr>
<?php
while ($blog = db_fetch_object($result)) {
print '<tr class="' . $row_color[$color_index] . '">';
print '<td>'.l($blog->name, 'blog/'.$blog->uid).'</td>';
?>
<td> <a href="blog/<?php print $blog->uid ?>/feed" target = "_blank"> <img src="misc/feed.png"/></a></td></tr>
<?php
// This switches $color_index between 0 and 1
$color_index = 1 - $color_index;
}
print '</table>';
?>
-----------------------------------------
Finally, I CMS that I Like!
http://www.CompShack.com
Thank you
That worked perfectly well, thankyou.
Totally OT, but may I ask how you inserted that paragraph of text on your website above the blog table? I can do it using print() however am unable to format any line breaks.
Easy
It is actually really easy. You don't have to use the print() function. Just add the following above the <?php tag!
Here is the text you see on my site - cheers!
This is a list of authors on the site. If you are interested in joining the team, please <a href="http://www.compshack.com/user/register" target="_self">register</a> first and submit your request using the <a href="http://www.compshack.com/contact" target="_self">contact form</a>. Make sure to include your current job title, IT skills, and topics you will be writing about.Do you mind leaving your website address so i can take a look at what you've done? :)
-----------------------------------------
Finally, I CMS that I Like!
http://www.CompShack.com
Thanks again
Just as part of my workflow I installed FCKeditor and that allowed me to Format text as I pleased in WYSIWYG mode and then add php code in 'source' mode. Worked well, with require line breaks (that was my problem to begin with, I couldn't get any line breaks). But unfortunately, FCKeditor moved the orange RSS to inline and above the table. So the table is now one row of buttons and one row per blog. For the moment I simply removed the button img references from your php code.
The site is being developed off-line, so once it is up I will show the work I have done.