Author bio component/mambot
-
- Joomla! Enthusiast
- Posts: 224
- Joined: Tue Sep 06, 2005 11:46 am
- Location: New Zealand
- Contact:
Author bio component/mambot
Hi all,
I'd like an option to have an author's bio included in an article. Because I wouldn't want it to appear in every single thing published on the site (like me just posting a news item) I'd like to have a way of controlling it. At the moment, I'm creating them manually like this one (see about the author)...
http://www.nzmac.com/index.php?option=c ... &Itemid=94
So here's the idea...
A component that allows you to create a number of simple author bios. These bio's MUST be named (or their ID should be) the same name that appears in an articles "by" field. I'd also like to be able to set the design of the bio box (so I can decide whther I want a certain CSS style for the whole area) and inlcude an author's image. I'd also want to be able to set the alignment of the bio's box (where it will appear on a page) at this point.
Then, whenever I'm creating a new article, if I want, I just slip in "{mosbio}" (I guess "joombio"?) into the text and Joomla picks up the name of the author from the author field, looks for an author bio and displays it.
Phil
I'd like an option to have an author's bio included in an article. Because I wouldn't want it to appear in every single thing published on the site (like me just posting a news item) I'd like to have a way of controlling it. At the moment, I'm creating them manually like this one (see about the author)...
http://www.nzmac.com/index.php?option=c ... &Itemid=94
So here's the idea...
A component that allows you to create a number of simple author bios. These bio's MUST be named (or their ID should be) the same name that appears in an articles "by" field. I'd also like to be able to set the design of the bio box (so I can decide whther I want a certain CSS style for the whole area) and inlcude an author's image. I'd also want to be able to set the alignment of the bio's box (where it will appear on a page) at this point.
Then, whenever I'm creating a new article, if I want, I just slip in "{mosbio}" (I guess "joombio"?) into the text and Joomla picks up the name of the author from the author field, looks for an author bio and displays it.
Phil
Re: Author bio component/mambot
Hey! I like that. Not sure it should be part of the core, but someone could pick that idea up and run.
Unless the Community Builder already allows for that to happen? Or perhaps CB is too strong a solution for this kind of implementation? Dunno.
Unless the Community Builder already allows for that to happen? Or perhaps CB is too strong a solution for this kind of implementation? Dunno.
-
- Joomla! Enthusiast
- Posts: 224
- Joined: Tue Sep 06, 2005 11:46 am
- Location: New Zealand
- Contact:
Re: Author bio component/mambot
The CB looked like a slightly different concept to me....more an "extended info" type of thing for all users. My idea targets more a group of people you might have as writers for a site and the cool thing is that there would be one bio per author...so (unlike at the moment) I wouldn't have to manually go round hunting for articles when someone says "Hey, can you update my bio info"
Phil
Phil
- TheSaint
- Joomla! Ace
- Posts: 1256
- Joined: Sat Aug 20, 2005 4:15 am
- Location: California, USA
- Contact:
Re: Author bio component/mambot
Seems like it should be a logical extension of the core. After all, aren't all Joomla sites going to have news articles? Every article has an author right? Tight intergration with user accounts would be great.
█ Paul
█ http://www.gamehostingreviews.com - In development
█ The only thing necessary for the triumph of evil is for good men to do nothing. - Edmund Burke
█ http://www.gamehostingreviews.com - In development
█ The only thing necessary for the triumph of evil is for good men to do nothing. - Edmund Burke
-
- Joomla! Explorer
- Posts: 270
- Joined: Fri Aug 19, 2005 2:37 am
- Location: Milwaukee, WI
- Contact:
Re: Author bio component/mambot
Here is a thread detailing how to have the authro's name link to his/her Community Builder profile. http://forum.mamboserver.com/showthread.php?t=27218
There is also mhAuthor - "mhAuthor is a combination mambot/component that allows you to create a link at the end of your content items to create a link to read more articles by the same author. Perfect for news/magazine type sites." http://www.joomla-hosting.com/free_mambo_software.html
Also MosAuthorXTD http://www.mamboexpert.com/index.php?op ... &Itemid=58
"this Mambot lets you create an individual string for the display of author, created, modified, usertype, section, category and hits. You can assign a css-class and choose from 4 different positions."
There is also mhAuthor - "mhAuthor is a combination mambot/component that allows you to create a link at the end of your content items to create a link to read more articles by the same author. Perfect for news/magazine type sites." http://www.joomla-hosting.com/free_mambo_software.html
Also MosAuthorXTD http://www.mamboexpert.com/index.php?op ... &Itemid=58
"this Mambot lets you create an individual string for the display of author, created, modified, usertype, section, category and hits. You can assign a css-class and choose from 4 different positions."
Web Geek Cafe - development and Joomla coaching webgeekcafe.org
YourTribe.com - group social events - yourtribe.com
YourTribe.com - group social events - yourtribe.com
-
- Joomla! Enthusiast
- Posts: 224
- Joined: Tue Sep 06, 2005 11:46 am
- Location: New Zealand
- Contact:
Re: Author bio component/mambot
Hmmm.I'd say close but no cigar....if I can be that fussy. Having had a quick play....
Community Builder....yeah, but I don't really want to use community builder with the site and the site users....I'd really want the bio appearing in the page, not taking them off to somewhere else.
mhAuthor looks cool, but all it does is (as it says)...allows you to create a link at the end of your content items to create a link to read more articles by the same author.
Mosauthorxtd just adds the following info into an article if you want it to . It just replaces "By Joe bloggs" with a longer piece of text that can include....author, created, modified, hits, section, category and usertype
-----
My approach was really a way of having prepared text (namely a bio and image) appear easily within an existing article...therefore, not requiring many changes at all to how you traditionally set up your site.
The reason I say that last part is that I'm also posting in a thread about a review component. Someone has pointed out a review component but it requires you also use facile forms, which moves you away from standard articles. Imagine how great it would be if the bio idea could also be extended to review...you just add {joomreview} to an article and all the ratings etc for the product appear, just like the author bio suggestion above.
Phil
Community Builder....yeah, but I don't really want to use community builder with the site and the site users....I'd really want the bio appearing in the page, not taking them off to somewhere else.
mhAuthor looks cool, but all it does is (as it says)...allows you to create a link at the end of your content items to create a link to read more articles by the same author.
Mosauthorxtd just adds the following info into an article if you want it to . It just replaces "By Joe bloggs" with a longer piece of text that can include....author, created, modified, hits, section, category and usertype
-----
My approach was really a way of having prepared text (namely a bio and image) appear easily within an existing article...therefore, not requiring many changes at all to how you traditionally set up your site.
The reason I say that last part is that I'm also posting in a thread about a review component. Someone has pointed out a review component but it requires you also use facile forms, which moves you away from standard articles. Imagine how great it would be if the bio idea could also be extended to review...you just add {joomreview} to an article and all the ratings etc for the product appear, just like the author bio suggestion above.
Phil
-
- Joomla! Explorer
- Posts: 270
- Joined: Fri Aug 19, 2005 2:37 am
- Location: Milwaukee, WI
- Contact:
Re: Author bio component/mambot
You could use Community Builder to manage the author profiles and then develop a custom mambot that displays the author thumbnail and any other CB fields you choose. That way you have one central place to keep track of an author's info and it would automatically appear at the top (or whereever you want it to) of each article.
Web Geek Cafe - development and Joomla coaching webgeekcafe.org
YourTribe.com - group social events - yourtribe.com
YourTribe.com - group social events - yourtribe.com
-
- Joomla! Enthusiast
- Posts: 224
- Joined: Tue Sep 06, 2005 11:46 am
- Location: New Zealand
- Contact:
Re: Author bio component/mambot
Thanks....'fraid I'm an ideas guy...not a coder...this is the "wishlist" section after all....wouldn't have a clue how to do it myself.
Phil
Phil
-
- Joomla! Explorer
- Posts: 324
- Joined: Sat Nov 05, 2005 7:43 pm
- Contact:
Re: Author bio component/mambot
How difficult is it to accomplish something of this nature? If there is one area that I find to be a drawback to Joomla it is that doing little things can involve so much and potential changes to the core. In the past I could create or easily modify templates that would easily handle plugging things like this in. Creating a mambot seems to involve some serious coding experience as it also requires packaging for installing, etc.scubaguy wrote: You could use Community Builder to manage the author profiles and then develop a custom mambot that displays the author thumbnail and any other CB fields you choose. That way you have one central place to keep track of an author's info and it would automatically appear at the top (or whereever you want it to) of each article.
As you can see, I'm new to Joomla for a few days, evaluating whether I want to use something like this or something more ready out of the box.
My modest signature was deleted after 8 years after I requested one dead link to be removed from my own post. Go figure. Here goes the promo version instead.
The Law Forum.
Legal advice forum
http://www.thelaw.com/forums/
The Law Forum.
Legal advice forum
http://www.thelaw.com/forums/
- Hackwar
- Joomla! Virtuoso
- Posts: 3788
- Joined: Fri Sep 16, 2005 8:41 pm
- Location: NRW - Germany
- Contact:
Re: Author bio component/mambot
Hi folks,
I thought about something similar, meaning a more generalized version of this. I don't know if it is possible with mosForms (is it even called that way?) The idea would be a scripting engine, with whom you can create forms to fill in the necessary data and which then is displayed as a page or something on your site. Could all be managed by xmls and for starters you could send a xml for authors, etc. with the standard package. could also replace the contacts stuff...
Hackwar
I thought about something similar, meaning a more generalized version of this. I don't know if it is possible with mosForms (is it even called that way?) The idea would be a scripting engine, with whom you can create forms to fill in the necessary data and which then is displayed as a page or something on your site. Could all be managed by xmls and for starters you could send a xml for authors, etc. with the standard package. could also replace the contacts stuff...
Hackwar
god doesn't play dice with the universe. not after that drunken night with the devil where he lost classical mechanics in a game of craps.
Since the creation of the Internet, the Earth's rotation has been fueled, primarily, by the collective spinning of English teachers in their graves.
Since the creation of the Internet, the Earth's rotation has been fueled, primarily, by the collective spinning of English teachers in their graves.
-
- Joomla! Explorer
- Posts: 324
- Joined: Sat Nov 05, 2005 7:43 pm
- Contact:
Re: Author bio component/mambot
Given that Joomla is a CMS and database, I think it should act like any other. I have never seen a CMS/BBS that didn't link the author's name to the author's bio and contact info. It strikes me as odd that now that I have figured out how to set up the "contact me" form which can contain multiple users, why isn't this auto linkable to what they publish? It's counterintuitive and I think it should have been part of the core a long time ago. A simple "show/hide" button in the admin panel for general should be sufficient to control this for those who don't want this ubiquitous feature.
My modest signature was deleted after 8 years after I requested one dead link to be removed from my own post. Go figure. Here goes the promo version instead.
The Law Forum.
Legal advice forum
http://www.thelaw.com/forums/
The Law Forum.
Legal advice forum
http://www.thelaw.com/forums/
- bigodines
- Joomla! Hero
- Posts: 2227
- Joined: Thu Aug 18, 2005 11:10 am
- Location: Floripa, Brazil
- Contact:
Re: Author bio component/mambot
Like this: http://www.mambopros.net/Artigos-e-Tuto ... bot-7.html ??scubaguy wrote: You could use Community Builder to manage the author profiles and then develop a custom mambot that displays the author thumbnail and any other CB fields you choose. That way you have one central place to keep track of an author's info and it would automatically appear at the top (or whereever you want it to) of each article.
If you guys want. I can post the code here. Its in portuguese but i can add a few comments in my poor english so you can understand
This was my 1st mambot and is very specific (that's why i dnd't released on developer.joomla) because it uses specific fields of CB to create this presentation.
cheers,
Matheus
- newart
- Joomla! Virtuoso
- Posts: 3177
- Joined: Fri Sep 02, 2005 10:06 am
- Location: Solar system - Earth - European Union
Re: Author bio component/mambot
Please, post here Bigodines as I'm very interested about your work. An idea of mine is to have a mambot that makes linkable the author name in the content article instead to have a bottom link of the author itself. What do you think about that idea?bigodines wrote: ...
If you guys want. I can post the code here. Its in portuguese but i can add a few comments in my poor english so you can understand
...
Moreover I think that this mambot you could "direct" to every page (not only to CB) but even towards the forum profile of the author. Do you like that?
I'll wait for your code
former Q&T WorkGroup Joomla member - Italian Translation Team Member
- bigodines
- Joomla! Hero
- Posts: 2227
- Joined: Thu Aug 18, 2005 11:10 am
- Location: Floripa, Brazil
- Contact:
Re: Author bio component/mambot
Ok, here we go:
I didn't test this version, but I *think* it will work Please lemme know if you have any trouble. I promise i'll work on a dynamically version of this but I'm a bit busy with simpleNews 2.0 right now.
Cheers!
Matheus
Code: Select all
<?php
/**
Community Builder - Author Info!
@author Matheus Mendes aka bigodines ( bigodines ->at->gmail.com )
@date April, 2005
@description Este mambot acrescenta uma pequena tabela com as informações do autor quando for digitada a tag {mosauthorinfo}
@requirements Community Builder
@package Mambo_4.5.2+ // Joomla 1.0+
@usage Just insert {mosauthorinfo} inside the content.... as you do with {mospagebreak} or {mosimage} :P
@license GPL
*/
/**
You will need to make some changes (on the SQL) in order to make this mambot work with your site.
Please look for the coments that contain [CHANGE] to see what you need type
*/
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/* Registering the mambot :D */
$_MAMBOTS->registerFunction( 'onPrepareContent', 'botAuthorInfo' );
/**
Essa função verifica se a tag {mosauthorinfo} existe no conteúdo. Se existir, troca por uma tabela com
as informações do autor daquele conteúdo.
eng: this function checks if the tag {mosauthorinfo} is in the content. If so, it'll replace the tag with a small table with some information about
the author
*/
function botAuthorInfo( $published, $row, $mask=0, $page=0 ) {
global $database;
if (!$published) {
return true;
}
$expressao = "#{mosauthorinfo}#s";
//echo "<pre>"; // debug
//print_r($row); // debug
//echo "</pre>"; // debug
/*
[CHANGE] This is the main SQL. Please replace the fields in the sql according to your CB fields.
Mine was: avatar (the picture)
site (user's website that will become a link)
apresentacao (a small text about this user...)
plus, i've created one field called 'media', that will stores an average rating of this author.
*/
$database->setQuery("SELECT user.name, perfil.avatar, perfil.site, perfil.apresentacao, SUM( notas.rating_sum ) / SUM( notas.rating_count ) as media
FROM #__comprofiler AS perfil
LEFT JOIN #__users AS user ON user.id = perfil.user_id
LEFT JOIN #__content AS c ON c.created_by = perfil.id
LEFT JOIN #__content_rating AS notas ON notas.content_id = c.id
WHERE perfil.id = '$row->created_by'
GROUP BY user.name");
$linha = null;
$database->loadObject( $linha );
/*
[CHANGE] This is the code that 'draws' the table. If you've had change (I hope you did, otherwise it won't work) the main SQL you'll need to replace/add
the fields' name on each line. For example the $linha->site gets the result of the field 'site' (see sql above) so if you don't have
this field in your community builder, you'll need to change for $linha->'something'
*/
$html = "<table width=\"200\" border=0 align=\"left\"><tr><td align=\"center\"><table width=\"180\" border=\"0\" bordercolor=\"#000000\" bgcolor=\"#F0F0F0\" cellpadding=\"2\">\n";
$html .= "<tr><td><b>Informações do autor:</b></td></tr>";
if ($linha->avatar)
$html .= "<tr><td align=\"center\" bordercolor=\"#F0F0F0\"><img src=http://www.mambopros.net/images/comprofiler/".$linha->avatar."></td></tr>";
if ($linha->name)
if ($linha->site)
$html .= "<tr><td bordercolor=\"#F0F0F0\">Nome: <a href=http://".$linha->site." target=\"_blank\">".$linha->name."</a></td></tr>";
else
$html .= "<tr><td bordercolor=\"#F0F0F0\">Nome: ".$linha->name."</td></tr>";
$html .= "<tr><td bordercolor=\"#F0F0F0\">Avaliação Média: ";
$html .= $linha->media ? $linha->media * 2 : "0.00" ;
$html .= "</td></tr>";
if ($linha->apresentacao)
$html .= "<tr><td bordercolor=\"#F0F0F0\">Sobre: <i>".$linha->apresentacao."</i></td></tr>";
$html .= "</td></tr></table></table>";
/*
done :D easy huh?
*/
//echo "<pre>"; // debug
//print_r($linha); // debug
//echo "</pre>"; // debug
$html;
// Ok, don't change anything below this line.
// vamos trocar!
$row->text = preg_replace( $expressao, $html, $row->text );
// beleza. retorno true para que o mambo continue fazendo o que deve ser feito.
return true;
}
?>
Code: Select all
<?xml version="1.0" encoding="iso-8859-1"?>
<mosinstall version="4.5.2" type="mambot" group="content">
<name>mosauthorinfo</name>
<author>Matheus Mendes</author>
<creationDate>April - 2005</creationDate>
<copyright>(C) 2005 </copyright>
<license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
<authorEmail>bigodines at gmail.com</authorEmail>
<authorUrl>http://www.joomla.com.br</authorUrl>
<version>1.0</version>
<description>Add author's info to content</description>
<files>
<filename mambot="mosauthorinfo">mosauthorinfo.php</filename>
</files>
<params/>
</mosinstall>
Cheers!
Matheus
- newart
- Joomla! Virtuoso
- Posts: 3177
- Joined: Fri Sep 02, 2005 10:06 am
- Location: Solar system - Earth - European Union
Re: Author bio component/mambot
A lot of thanks!!! I'll test next week soon...
I wish you a good work for SimpleNews, I've tested the old one but I find troubles... and I hope that you solve certain problems. Moreover my question is why have you decided for a non-component solution?
I wish you a good work for SimpleNews, I've tested the old one but I find troubles... and I hope that you solve certain problems. Moreover my question is why have you decided for a non-component solution?
former Q&T WorkGroup Joomla member - Italian Translation Team Member
- bigodines
- Joomla! Hero
- Posts: 2227
- Joined: Thu Aug 18, 2005 11:10 am
- Location: Floripa, Brazil
- Contact:
Re: Author bio component/mambot
[off-topic]
Because our journalists hate joomla (they are too stupid to use it lol), se we needed a solution outside. But sN 2.0 will have two versions.. as a comopnent (for the front-end) and as the regular sN, outside joomla, just sharing the same database...
[/off-topic]
Because our journalists hate joomla (they are too stupid to use it lol), se we needed a solution outside. But sN 2.0 will have two versions.. as a comopnent (for the front-end) and as the regular sN, outside joomla, just sharing the same database...
[/off-topic]
- newart
- Joomla! Virtuoso
- Posts: 3177
- Joined: Fri Sep 02, 2005 10:06 am
- Location: Solar system - Earth - European Union
Re: Author bio component/mambot
[off-topic]bigodines wrote: [off-topic]
Because our journalists hate joomla (they are too stupid to use it lol), se we needed a solution outside. But sN 2.0 will have two versions.. as a comopnent (for the front-end) and as the regular sN, outside joomla, just sharing the same database...
[/off-topic]
Great!!! I'll wait for that! and a lot fo thanks in advance!!!!
PS. If you need a different test opinion I can offer my live test site for that...
[/off-topic]
former Q&T WorkGroup Joomla member - Italian Translation Team Member
- Phleum
- Joomla! Apprentice
- Posts: 27
- Joined: Wed Sep 14, 2005 2:30 am
- Location: Boston
Re: Author bio component/mambot
Hi there,
I'm still pretty new to all of this and SQL doesn't always make sense to me. I'm having trouble making this work with my site.
When I try it, it shows the first set with just the text, and then nothing more, and I'm sure my SQL skills are to blame...
What is "perfil", and what keeps me from writing it to directly access #_comprofiler?
You're right, if all those were in parameters, it would make it a lot easier for simpletons like me! But I'll figure it out...
Thanks for sharing!
I'm still pretty new to all of this and SQL doesn't always make sense to me. I'm having trouble making this work with my site.
When I try it, it shows the first set with just the text, and then nothing more, and I'm sure my SQL skills are to blame...
What is "perfil", and what keeps me from writing it to directly access #_comprofiler?
You're right, if all those were in parameters, it would make it a lot easier for simpletons like me! But I'll figure it out...
Thanks for sharing!
-
- Joomla! Intern
- Posts: 94
- Joined: Thu Oct 13, 2005 3:19 pm
Re: Author bio component/mambot
Hello everyone,
Any news about importing this wondefull tool to CB 1.00 stable?
Any news about importing this wondefull tool to CB 1.00 stable?
-
- Joomla! Enthusiast
- Posts: 224
- Joined: Tue Sep 06, 2005 11:46 am
- Location: New Zealand
- Contact:
Re: Author bio component/mambot
Umm...have you looked on the Joomlapolis site. The CB AuthorBot is available for stable and is working well...
http://www.joomlapolis.com/component/op ... Itemid,36/
Phil
http://www.joomlapolis.com/component/op ... Itemid,36/
Phil
-
- Joomla! Intern
- Posts: 94
- Joined: Thu Oct 13, 2005 3:19 pm
Re: Author bio component/mambot
Thank you phil-roy for your answer. I have used CB AuthorBot but his only functionality is to create a link back to the authors profile. I need to have a "mini profile" inside each article, such as a photo, some words about the author and a link back to his full profile. This can work in conjugation with CB AuthorBot that creates a link from the authors name, back to his profile.
- iJoomla
- Joomla! Apprentice
- Posts: 43
- Joined: Wed Dec 07, 2005 5:22 am
- Location: Long Beach, CA, USA
- Contact:
Re: Author bio component/mambot
Hi guys,phil_roy wrote: Hi all,
I'd like an option to have an author's bio included in an article. Because I wouldn't want it to appear in every single thing published on the site (like me just posting a news item) I'd like to have a way of controlling it. At the moment, I'm creating them manually like this one (see about the author)...
I bumped into this post and I thouhgt I'd let you know that the new version of iJoomla Magazine has this feature.
EDIT MOD: self promotion.
See Forum rules
Last edited by infograf768 on Fri Jul 14, 2006 9:33 am, edited 1 time in total.
- Phleum
- Joomla! Apprentice
- Posts: 27
- Joined: Wed Sep 14, 2005 2:30 am
- Location: Boston
Re: Author bio component/mambot
I stumbled on a new version of CBAuthorBot and remembered this conversation. At Joomlapolis, some folks have modified CBAuthorBot to do much of this, including showing the avatar, and with tweaking, adding other information. I'm using it now with the picture and a bio, and it seems to work fine.halobay wrote: Thank you phil-roy for your answer. I have used CB AuthorBot but his only functionality is to create a link back to the authors profile. I need to have a "mini profile" inside each article, such as a photo, some words about the author and a link back to his full profile. This can work in conjugation with CB AuthorBot that creates a link from the authors name, back to his profile.
http://www.joomlapolis.com/component/op ... 446/#17446
Hope it helps.
-
- Joomla! Intern
- Posts: 94
- Joined: Thu Oct 13, 2005 3:19 pm
Re: Author bio component/mambot
Thank you for your anser.
Could you please give me a link to an example page? Have you managed to make it work like that we are describing?
Thanks in advance
Could you please give me a link to an example page? Have you managed to make it work like that we are describing?
Thanks in advance
-
- Joomla! Fledgling
- Posts: 4
- Joined: Sun Apr 16, 2006 11:11 am
Re: Author bio component/mambot
Hibigodines wrote: Ok, here we go:Code: Select all
<?php /** Community Builder - Author Info! @author Matheus Mendes aka bigodines ( bigodines ->at->gmail.com ) @date April, 2005 @description Este mambot acrescenta uma pequena tabela com as informações do autor quando for digitada a tag {mosauthorinfo} @requirements Community Builder @package Mambo_4.5.2+ // Joomla 1.0+ @usage Just insert {mosauthorinfo} inside the content.... as you do with {mospagebreak} or {mosimage} :P @license GPL */ /** You will need to make some changes (on the SQL) in order to make this mambot work with your site. Please look for the coments that contain [CHANGE] to see what you need type */ defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); /* Registering the mambot :D */ $_MAMBOTS->registerFunction( 'onPrepareContent', 'botAuthorInfo' ); /** Essa função verifica se a tag {mosauthorinfo} existe no conteúdo. Se existir, troca por uma tabela com as informações do autor daquele conteúdo. eng: this function checks if the tag {mosauthorinfo} is in the content. If so, it'll replace the tag with a small table with some information about the author */ function botAuthorInfo( $published, $row, $mask=0, $page=0 ) { global $database; if (!$published) { return true; } $expressao = "#{mosauthorinfo}#s"; //echo "<pre>"; // debug //print_r($row); // debug //echo "</pre>"; // debug /* [CHANGE] This is the main SQL. Please replace the fields in the sql according to your CB fields. Mine was: avatar (the picture) site (user's website that will become a link) apresentacao (a small text about this user...) plus, i've created one field called 'media', that will stores an average rating of this author. */ $database->setQuery("SELECT user.name, perfil.avatar, perfil.site, perfil.apresentacao, SUM( notas.rating_sum ) / SUM( notas.rating_count ) as media FROM #__comprofiler AS perfil LEFT JOIN #__users AS user ON user.id = perfil.user_id LEFT JOIN #__content AS c ON c.created_by = perfil.id LEFT JOIN #__content_rating AS notas ON notas.content_id = c.id WHERE perfil.id = '$row->created_by' GROUP BY user.name"); $linha = null; $database->loadObject( $linha ); /* [CHANGE] This is the code that 'draws' the table. If you've had change (I hope you did, otherwise it won't work) the main SQL you'll need to replace/add the fields' name on each line. For example the $linha->site gets the result of the field 'site' (see sql above) so if you don't have this field in your community builder, you'll need to change for $linha->'something' */ $html = "<table width=\"200\" border=0 align=\"left\"><tr><td align=\"center\"><table width=\"180\" border=\"0\" bordercolor=\"#000000\" bgcolor=\"#F0F0F0\" cellpadding=\"2\">\n"; $html .= "<tr><td><b>Informações do autor:</b></td></tr>"; if ($linha->avatar) $html .= "<tr><td align=\"center\" bordercolor=\"#F0F0F0\"><img src=http://www.mambopros.net/images/comprofiler/".$linha->avatar."></td></tr>"; if ($linha->name) if ($linha->site) $html .= "<tr><td bordercolor=\"#F0F0F0\">Nome: <a href=http://".$linha->site." target=\"_blank\">".$linha->name."</a></td></tr>"; else $html .= "<tr><td bordercolor=\"#F0F0F0\">Nome: ".$linha->name."</td></tr>"; $html .= "<tr><td bordercolor=\"#F0F0F0\">Avaliação Média: "; $html .= $linha->media ? $linha->media * 2 : "0.00" ; $html .= "</td></tr>"; if ($linha->apresentacao) $html .= "<tr><td bordercolor=\"#F0F0F0\">Sobre: <i>".$linha->apresentacao."</i></td></tr>"; $html .= "</td></tr></table></table>"; /* done :D easy huh? */ //echo "<pre>"; // debug //print_r($linha); // debug //echo "</pre>"; // debug $html; // Ok, don't change anything below this line. // vamos trocar! $row->text = preg_replace( $expressao, $html, $row->text ); // beleza. retorno true para que o mambo continue fazendo o que deve ser feito. return true; } ?>
I didn't test this version, but I *think* it will work Please lemme know if you have any trouble. I promise i'll work on a dynamically version of this but I'm a bit busy with simpleNews 2.0 right now.Code: Select all
<?xml version="1.0" encoding="iso-8859-1"?> <mosinstall version="4.5.2" type="mambot" group="content"> <name>mosauthorinfo</name> <author>Matheus Mendes</author> <creationDate>April - 2005</creationDate> <copyright>(C) 2005 </copyright> <license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license> <authorEmail>bigodines at gmail.com</authorEmail> <authorUrl>http://www.joomla.com.br</authorUrl> <version>1.0</version> <description>Add author's info to content</description> <files> <filename mambot="mosauthorinfo">mosauthorinfo.php</filename> </files> <params/> </mosinstall>
Cheers!
Matheus
I want to convert this mambot to modul or I want show in the left block this mambot. What can I do?