Things they don't teach you in school
Heres a Tip for you Dolphin hackers
The title tags for Dolphin articles do not reflect the actual article title. This is important for search engine indexing. So here’s how to fix it:
This hack requires modifying two files, first:
articles.php
line 33:
$_page_cont[$_ni]['page_main_code'] = PageCompArticles();
The PageCompArticles() function is responsible for calling subordinate code that displays the article, article list, etc. You can see in the code that it is called first before this:
$_page['header'] = _t( “_ARTICLES_H”, $site['title'] );
This line sets up the <title></title> tag of the page. What we want to do is move this line above line 33:
$_page['header'] = _t( “_ARTICLES_H”, $site['title'] );
$_page_cont[$_ni]['page_main_code'] = PageCompArticles();
Now, when PageCompArticles() is called, the title of the page is already set, so we can feel free to modify it inside the next file:
inc/classes/BxDolArticles.php
Depending on your code, we are looking for about line 230 for this line:
$aArticle = db_arr( $sArticleQuery );
It should be inside the getArticle function.
We want to add the following after the above line:
$sTitle = process_line_output( $aArticle['Title']);
global $_page;
$_page['header']=$sTitle .’ - ‘ .$_page['header'];
Now, when our users visit our article page it will have a page title like so:
Another great article title - mysite title
Also, I suggest that you always put yoursite.com as part of your site title. So if your actual site title is: Best Darn Website add on ” - bestdarnwebsite.com” to the site title (language settings)
I’ve been looking a lot lately at “open source” applications to build a social networking site. I’ve read quite a few reviews on Drupal, Elgg, Pligg, etc. My time is limited so I couldn’t possibly install and test them all. I have used Drupal in the past and was less than ecstatic about it. Elgg looks promising as a pure Free as in Free Beer application. I decided to avoid Pligg for the politics involved (Read the comments on pligg.com vs pligg.net and you’ll see what I mean). Although not Free as in Free Beer, Dolphin by boonex.com offers some compelling features such as photo, video, music, dating, classifieds and user blogging.
It was a snap to install, although you need control over permissions as the installer is adamant about them. It is a CSS oriented system so changing colors etc is easy. However, doing anything more than basic color scheme changing requires a lot of nut-cracking. HTML is buried in PHP code so deep you’ll need a ladder to climb back out. This is one element of software design which I deplore. Seems PHP developers just cannot get out of that mindset of putting HTML inside their PHP code. I mean, just because you can doesn’t mean you should. Ok, off the soapbox now.
After using Dolphin for about a week in a vanilla install, my natural need for hacking toko over. First up was to get rid of the “dating” focus that Dolphin has and make it a more generic social networking system. I’ll admit, my tendency to dive right into the code is sometimes a bad thing. What I discovered about Dolphin: a lot of customization is available without actually editing code. Case in point. I wanted to remove the “I am a man seeking a woman” default search box and replace it with Google search. I dived right into the code trying to find the search form template. To my amusement, all I really needed to do was use Dolphin’s drag and drop interface to remove the box from the home page, and create my own, custom content block for Search. Yes, I know. RTFM. Like I said, it’s my nature to hack.
So once I laughed that off, I was on to bigger and better hacking. Next up: Replace the Ray video player which displays dating ads on my site. Caveat here folks. Dolphin is adware. Payware. Whatever-ware. The price is cheap enough. $39 for the base ad-free license. Then they get $39 (per year) license for all the cool modules like Video player, Video chat, etc. All told you could spend about $900+ per year in full licenses. That is not bad considering what you get. But I’m all about baking my own cake.
After I conquered the video player hack, I moved on to my next target. Blog feeds. There are no RSS or Atom feeds in Dolphin’s blogs, which I thought a huge shortcoming. So I managed to get Atom feeds up, human and SEO friendly permalinks , as well as feed autodiscovery (this is the part the browsers detect and display a Subscribe to… icon). So now when a user lands on the list of blogs page, they also get a list of feeds they can subscribe to. Of an important side note, Google loves blogs. And blog feeds are the juiciest of content for search engine spiders.
Next on my list of Dolphin hacks are to fix page titles so they reflect the focus of the page content. Case in point, when viewing an article, the title of the page should be the title of the article, not “Articles”. This same problem is displayed in classifieds, blogs, etc. Lots of hacking to do.
Now I come to my quagmire. If I hack Dolphin in its current release, what happens when they release a new version? Well, I’m glad you asked! I use a tool that compares two directories and I can merge their changes into my code, and vice-a-versa. This should help me keep up to date with their changes without losing my own. Now if they had a subversion repository, it would be even easier
All in all, Dolphin is proving to be one social app worth using. Can you recommend any others?
My day to day (actually night to night, weekends, holidays, before work, after work, and too many hours to count) web surfing and contacts with folks on the internet frequently lead me to experimenting with some new software, or in this case, developing a mod or a patch to an existing application. PHP Fox is yet another example of a fine piece of social networking software with room for improvement. As a result of a contact I made on a forum some time ago, I was engaged in modifying this application to show some basic stats on the home page. At first glance it seemed daunting, and not a job I really wanted to tackle. But as I peeked under the hood of the admin interface, I found some shortcuts and I am going to post them here.
The basic features of this app include:
The basic home page for the system looks like so:
What the user wanted was to add a stats module displaying the count of profiles, forums, etc the system has acquired. The admin page already had a module that displayed the info but not the front end site. So I basically modified the existing code to perform both in the admin context and the front end context, and added a function call to the home page template. The results looked like so:
The module appears on the lower right side of the home page. To apply this page, only three files were changed:
new file: includes/modules/Admin/classes/PhpFox_ComponentTodayStats.class.php
[php]
/* ———————— start PhpFox_ComponentTodayStats.class.php ————-*/
<?php
App::loadClass(’BaseComponent’);
/** Component for displaying site warnings
*
* @author Alexey Gaponik
* @version $Id: PhpFox_ComponentTodayStats.class.php 819 2006-09-19 14:39:29Z gaponik $
* @package module.admin
*/
class PhpFox_Mod_Admin_ComponentTodayStats extends BaseComponent
{
/** Process
*/
function process()
{
$oSrvAdmin = $this->_oModule->getService(’Admin’);
/* @var $oSrvAdmin PhpFox_Mod_Admin_ServiceAdmin */
$oTpl = &$this->_oModule->getTemplate();
$oTpl->assign(array(
‘aStats’ => $oSrvAdmin->getTodayStats(),
‘aParams’=>$this->_aParams
));
return $oTpl->fetch(’TodayStats.html’);
}
}
?>
/*———————— end of PhpFox_ComponentTodayStats.class.php ————-*/
[/php]
Lastly, I Made changes to a template: design/templates/public/index.visitor.html
Towards the bottom of this file you will see a line “</td>{* END right column *}”
Just above the </td> we put this code:
<br />
<table style=”width:100%;” cellspacing=”0″ cellpadding=”0″>
<tr>
<td style=”width:2%;”>
<img src=”{$sStylePath}line5.gif” alt=”" style=”vertical-align:bottom;” />
</td>
<td style=”width:98%;font-size:8pt;vertical-align:middle;” class=”mainmenu3″>
<div style=”padding-left:10px;”>
<span style=”vertical-align:middle;”> <b>TODAYS STATS</b> </span>
</div>
</td>
</tr>
</table>
<br/>
<div style=”text-align:center;”>
{module module=’Admin’ component=’TodayStats’ notitle=’true’}
</div>
I had to modify the admin template a bit too:
design/templates/_modules/Admin/TodayStats.html
Essentially, I just put an if .. then around the table header so I could customize it and add some flare:
{if $aParams.notitle!=’true’}
<tr>
<td class=”row-header” colspan=”2″><span>TODAYS SITE STATS</span></td>
</tr>
{/if}
web·pit n. a place of discovery; a repository of information; where coders come for enlightenment; a programmers diary.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Mar | ||||||
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |