Part of the EllisLab Network
   
1 of 2
1
Coda Comments Plugin
Posted: 22 February 2009 01:07 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  197
Joined  06-23-2008

I just finished a small plug-in that allows to easily add CodeIgniter style comments in Coda. I was inspired by the DevMark Plug-in by Erwan Tossen, yet wanted to add more customization and flexibility.

After adding the plug-in to Coda you first need to set the preferences in the config file and save it.

;    CodeIgniter Comments - Preferences
;    ------------------------------------
;    
This file work like "php.ini" files.
;    
Don't remove [xxx] lines !

[config]

    date = m/d/Y    
    author = title,-,descr,-,license,author,link,email,-,file,version,date,-,copyright
    block = title,-,descr

[author]

    descr = Description
    author = Your name    
    link = http://your-name.com
    email = info@your-name.com    
    license = GNU General Public License
    version = 1.0
    
[block]

    descr = Description

Add Author (Ctrl+Shift+A)
The Add Author function lets you add a comment block like this:

/**
* Title
*
* Description
*
* @license     GNU General Public License    
* @author      Frank Michel
* @link        http://frankmichel.com
* @email       info@frankmichel.com
*
* @file        test.php
* @version     1.0
* @date        02/22/2009
*
* Copyright (c) 2009
*/

To add a comment block simply select your typed title and add the author block with Ctrl+Shift+A.

You can easily re-arrange the items of this block by editing the comma separated author line in the [config] section of the preferences. You can use any of the following special items or add a blank line with a dash “-”

title - the input text from the selection
descr - the default description placeholder from the preferences
file - the current file name
date - the current date in the format you defined in the preferences
copyright - a copyright notice

NEW:
Any other item you add to the preferences file can be supplied with a default value. So if you like to add…

/**
* @example   DefaultValue
*/

...simply append “example” to the comma separated author line in the [config] section of the preferences file and optionally add the following line to the [author] section:

example = DefaultValue

This feature gives you great flexibiliy in adding custom items with default values.

Add Block (Ctrl+Shift+B)
The Add Block function lets you add a comment block like this:

/**
* Function Name
*
* Description
*/

Special items are only title and descr. Adding other items is just as easy as described above. Please make sure to put your default values in the [block] section of the preferences file.

Add Line (Ctrl+Shift+L)
This function lets you easily add a line like this:

// --------------------------------------------------------------------------

Add GPL (Ctrl+Shift+G)
This function lets you add a GPL license block.

Add EOF (Ctrl+Shift+E)
This function lets you add the document footer in a CI style:

/* End of file test.php */
/* Location: ./application/libraries/test.php */

Last but not least there’s an Update Date (Ctrl+Shift+U) function that let’s you automatically update the date in the author block as specified in the preferences file.

You can download the plug-in here:
CI Comments Coda Plug-in

I hope you enjoy it! Happy commenting smile

 Signature 

Tired of Forms? Check out Form Generation Library
Using Coda? Get the Coda Comments Plug-in

Profile
 
 
Posted: 22 February 2009 05:12 PM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1074
Joined  05-17-2008

That’s a great plugin!
I changed one thing:
The document footer contained the absolute system path:

/* End of file Layout.php */
/* Location: ./Volumes/Macintosh HD/Users/[...] */

So I changed Add EOF to the following to get the relative path:

#!/usr/bin/php
<?php
    
/**
     * CodeIgniter Comments
     *
     * @file        Add EOF.php
     * @license        GNU General Public License
     * @author        Frank Michel
     * @link        http://frankmichel.com
     * @email        info@frankmichel.com
     * @version        1.0
     * @date        02/21/2009
     *
     * Copyright (c) 2009
    */
    
    
$site_path = getenv('CODA_SITE_LOCAL_PATH');
    
$file_path = getenv('CODA_FILEPATH');
    
$ending = getenv('CODA_LINE_ENDING');
    
    
$file = substr(strrchr($file_path, "/"), 1);
    
$extension = substr(strrchr($file, "."), 1);
    
    if(!empty(
$site_path))
    
{
        $file_path
= substr($file_path, strlen($site_path));
    
}
    
    $output
= "/* End of file ".$file." */".$ending;
    
$output .= "/* Location: .".$file_path." */";
    
    echo
$output;
?>
Profile
 
 
Posted: 22 February 2009 05:23 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  197
Joined  06-23-2008

Thanks pistolPete!

I’ll update the plug-in right away.

 Signature 

Tired of Forms? Check out Form Generation Library
Using Coda? Get the Coda Comments Plug-in

Profile
 
 
Posted: 22 February 2009 06:34 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  197
Joined  06-23-2008

I just added some more flexibility to the plug-in. The new feature (see above) will let you easily add new custom items with default values to the author and block sections.

 Signature 

Tired of Forms? Check out Form Generation Library
Using Coda? Get the Coda Comments Plug-in

Profile
 
 
Posted: 22 February 2009 07:17 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  197
Joined  06-23-2008

In case you are using my plug-in please let me know if you have some feedback. There’s actually one thing I wasn’t sure what users will prefer:

In the current version of the plug-in the cursor is positioned right after the comment closing. Would you prefer to have another carriage return, so the cursor is positioned at the beginning of the new line right after the comment block instead?

 Signature 

Tired of Forms? Check out Form Generation Library
Using Coda? Get the Coda Comments Plug-in

Profile
 
 
Posted: 01 March 2009 04:26 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
RankRank
Total Posts:  158
Joined  06-06-2007

For some reason the add author option is greyed out after I installed it.

Any ideas?

Kevin

 Signature 

Codeigniter - Saving Kittens from Drupal

Profile
 
 
Posted: 01 March 2009 04:28 PM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1074
Joined  05-17-2008

You have to select some text to be able to use it.

To add a comment block simply select your typed title and add the author block with Ctrl+Shift+A.

Profile
 
 
Posted: 01 March 2009 04:28 PM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  197
Joined  06-23-2008

You need to select some text which will be transformed into the “Title”. As soon as you selected the text, the function will become available.

 Signature 

Tired of Forms? Check out Form Generation Library
Using Coda? Get the Coda Comments Plug-in

Profile
 
 
Posted: 21 May 2009 04:43 PM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  323
Joined  08-29-2008

So whats coda like? have you ever used zend?

I took a look at coda and it looks pretty sweet for what it is…

 Signature 

421 Entertainment :: YAAS - Yet Another Authentication System :: Error Logger

Profile
 
 
Posted: 16 September 2009 03:56 PM   [ Ignore ]   [ # 9 ]  
Grad Student
Rank
Total Posts:  62
Joined  04-02-2008

coda is a great IDE for mac developers.

p.s. great plugin!

Profile
 
 
Posted: 16 September 2009 04:01 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  323
Joined  08-29-2008

Yeah I ended up buying it, quite a while ago. Now im working on setting up a local svn to post to!

 Signature 

421 Entertainment :: YAAS - Yet Another Authentication System :: Error Logger

Profile
 
 
Posted: 16 September 2009 04:03 PM   [ Ignore ]   [ # 11 ]  
Grad Student
Rank
Total Posts:  62
Joined  04-02-2008

local svn, are you doing that on your mac?

Profile
 
 
Posted: 16 September 2009 04:04 PM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  323
Joined  08-29-2008

Trying to.
I want to set it up so when I am offline I can sync to my mac (local dev) and if I am online itll have a hook to update to my web server

 Signature 

421 Entertainment :: YAAS - Yet Another Authentication System :: Error Logger

Profile
 
 
Posted: 15 October 2009 06:35 AM   [ Ignore ]   [ # 13 ]  
Summer Student
Total Posts:  1
Joined  09-08-2009

Hi macigniter,

I just registered to thank you for creating this plugin. It is great and I started using it extensively.

Thanks!

Profile
 
 
Posted: 24 October 2009 12:00 AM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  323
Joined  08-29-2008

Getting a bug with author

Warning: date(): It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Los_Angeles’ for ‘PDT/-7.0/DST’ instead in /Users/Trevor/Library/Application Support/Coda/Plug-ins/CI Comments.codaplugin/Contents/Resources/678D6E66-4424-46FC-BE60-39787E3AFC40/Add Author on line 49

Warning: date(): It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Los_Angeles’ for ‘PDT/-7.0/DST’ instead in /Users/Trevor/Library/Application Support/Coda/Plug-ins/CI Comments.codaplugin/Contents/Resources/678D6E66-4424-46FC-BE60-39787E3AFC40/Add Author on line 53

 Signature 

421 Entertainment :: YAAS - Yet Another Authentication System :: Error Logger

Profile
 
 
Posted: 11 November 2009 02:27 AM   [ Ignore ]   [ # 15 ]  
Summer Student
Total Posts:  2
Joined  12-04-2005

For those who upgraded to Snow Leopard 10.6.x, you will need to update your php.ini file by adding your timezone to do away with the date error.

date.timezone = America/Los_Angeles

See for more info:

http://discussions.apple.com/thread.jspa?threadID=2131828&tstart=0

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 721, on January 06, 2010 09:38 AM
Total Registered Members: 115012 Total Logged-in Users: 68
Total Topics: 122446 Total Anonymous Users: 5
Total Replies: 647326 Total Guests: 548
Total Posts: 769772    
Members ( View Memberlist )