After installing sfMediaLibrary plugin on my local dev environment (OSX, MAMP, symfony v1.1 PEAR), I found the paths to the images were incorrect as the forward slashes in the directories to the images were doubled up (eg: //uploads//assets//imagename.jpg).

I found a hack solution by editing youproject/plugins/sfMediaLibraryPlugin/modules/sfMediaLibrary/lib/BasesfMediaLibraryActions.class

In the executeIndex() function I removed the extra forward slashes by changing the following line:

$this->webAbsCurrentDir = $this->getRequest()->getRelativeUrlRoot().’/’.$this->uploadDirName.’/’.$currentDir;

to:

$this->webAbsCurrentDir = $this->getRequest()->getRelativeUrlRoot().$this->uploadDirName.$currentDir;

I know this solution is less than ideal, but will do for now.

I found this error when trying to install the sfMediaLibrary plugin for symfony 1.1

The fix was to go to your settings.yml in your app’s config dir and set compat_10 setting to ‘on’. ie:

  1. Go to: apps/your_app/config/settings.yml
  2. Search for the line with text ‘compat_10’
  3. Make sure setting isn’t commented and set as ‘on’

My Symfony submenu

September 16, 2008

Ok, I needed a submenu that needed to be different between some different modules. Being a symfony newb Ads pointed me towards the component_slot. Perfect!

Ok so first I created a submenu module and the component class. In the component class I define the elements of the submenu links (they’ll do as hardcoded atm).  Instead of having to create a partial for each menu type, I created a single partial and placed that in the global templates folder, _submenu.php:

<ul>
<?php foreach ($opts AS $label => $url):?>
<li><?php echo link_to($label,$url)?></li>
<?php endforeach?>
</ul>

The comonent class where I define the submenu options/links:

class submenuComponents extends sfComponents
{
// default backend submenu
public function executeDefault()
{
$opts = array(‘Login’ => ‘@sf_guard_signin’
);
echo get_partial(‘../submenu’,array(‘opts’ => $opts));
return true;
}

// blog admin section submenu
public function executeBlog()
{
$opts = array(
‘Posts’ => ‘@postList’,
‘Comments’ => ‘@commentList’,
‘Categories’ => ‘@categoryList’,
);
echo get_partial(‘../submenu’,array(‘opts’ => $opts));
return true;
}

// user admin section submenu
public function executeUser()
{
$opts = array(
‘Users’ => ‘sfGuardUser/index’,
‘User Permissions’ => ‘sfGuardPermission/index’,
‘User Groups’ => ‘sfGuardGroup/index’
);
echo get_partial(‘../submenu’,array(‘opts’ => $opts));
return true;
}
}

Now all I have to do is configure each module to use a module type. The menu will default to the one set in the app/global view.yml

global view.yml:

default:
components:
submenu: [submenu, default]

Example module view.yml (ie: blogPost) selecting a different submenu:

default:
components:
submenu: [submenu, blog]

For the sfGuard modules I created a module folder to my app for all the modules I wanted to select a submenu for. Then added a view.yml and selected a menu like the call above.

It all seems to be working well :D~. THanks adam ❤

Symfony admin icon set

September 10, 2008

Stumbled upon this dude and his freaking wicked icon sets he provides. The Silk icon set seems to pretty much be the ones used for symfony.

These will definately get some use ❤ mr Mark James

Symfony admin theme

September 9, 2008

I created my first symfony admin theme last night. It was rediculously easy, and the best thing is, it freaking works like a dream! I shamelessly stole the design of some dudes blog. It fits into an admin backend design surprisingly well lol.

I’ve fallen heavily in love with the admin generation in Symfony. It seems i’ve been doing way too much manually. I have to thank Adam for nudging to look at it, hes been a massive help and a great motivator! ❤ ❤ (much luv and ballsacs for u)

I’ve almost finished my blog app. Just need to do the post tagging, and archive generation and my learning app will be complete! 😀 I’m thinking of buying my own personal domain and putting my blog up on there, hopefully there is a way to export my stuff from my wordpress acc.

Today is a good day 🙂

I had some trouble trying to set the default value for the ‘publish_date’ field in the backend generated admin section for my Blog app. I stumbled upon this, which explains about overwriting a function in the action class generated in the cache. There you can set any value for the object you’re editing.

My_first_project 2

May 7, 2008

I had a few problems with the tutorial last night, and found a document noting all the errors in the tutorial! GOLD! Here it is just in case anyone else finds it useful.

symfony11documentation-myfirstproject

Includes the fix for: Fatal error: Call to undefined method Post::__toString()

And when you change your db to use MYSQL but the app still references SQLite.

Anyway, back to it, things are going well! 😀

My_first_project

May 6, 2008

Well, i spent a couple of hours trying to do the my_first_project tutorial. I had a couple of hiccups along the way. One was trying to find out how to install libxslt.

It took me a few minutes before i realised that  the xsl.dll included with php in the WAMP server setup was sufficient. I removed the comment from the php.ini to allow the extension to run.

Another problem I had was with the sqlite db. When trying to insert the sql, the script couldn’t find my sqlite db. I tried putting relative & absolute paths to the db in my propel.ini but still no luck.  I then tried a local mysql db which worked! The data inserted fine, i then changed my databases.yml to use the mysql server and WHAM shes working. Not too bad, but it’s a bit late so will have to leave it for another time before I can have a good stab at it.

Trying SVN

March 13, 2008

I’ve been planning on using a content versioning system for sooo long and I’ve finally made the move. Im using TortoiseSVN. So far its been pretty straight forward, i can’t wait to start thrashing it for all my web dev (also gotta get an online server working somehow). I made the move because i’m going to attempt to get a working merged system of MODx & phpshop 1.2.

I have had one problem though, when creating a tag from the HEAD, it only copies the files and not the child directories and their folders… hrmrmrm

RoR

March 11, 2008

Last night I decided to have a break from the code. So I decided to read up on RoR. Evan had been harping on about how glorious it is so I thought I would give it a shot. I had a look at this intro tute, decided to print it out and ended up staying up all night reading the entire thing. It seemed the more I read on, the more I came to realise the similarities of RoR to the CodeIgniter php framework that I have come to love. The first impressions I get of RoR is that it has a strong sence of an application development environment about it. The OOP, the automation, the testing, its all just too easy. A little too easy some might say. Anyway, being a developer based predominantly on php & javascript there were a few things that stood out to me which were:

  • The forced OOP
  • Ruby’s quick & simple syntax
    • Method dot notation & no requirement to tack on empty parentheses after a method call that has no parameters.
    • A method automatically returns the return value of the last line of code in the method.
    • The ! and ? method notations.
    • Shorthand setter method notation. eg: car.mileage = 5000 instead of car.mileage(5000)
    • No ++ or — operators 😦
    • Shortcut string declearations that use quotes. eg: %Q(Arnie said, "I'm back!")
    • Array decleration of just using brackets. eg: service_mileage = [5000, 15000, 3000]
    • Shorthand string array declearation. eg: %w ( red green blue black )
    • Hashes
    • Symbols (like a string literal but with basic functionality)
    • Blocks! (like prototype .each())
  • The automated 3 environments (development, testing, production)
  • MVC architecture
  • ActionPack including ActionRecord (which I love in codeIgniter)
  • ActionMailer (rail’s generic email handler)
  • Code generation
  • Testing & Debugging

I think my next little web app that I try will be in RoR 🙂