[Pro] Freeway with CodeIgniter

I’m more of a PHP coder than designer. I recently found that I needed to hone my design abilities more and picked up Freeway Pro as my design tool. It looked like a very flexible and extensible system while still being lighter and faster to pick up than Adobe’s products.

That said, has anyone used Freeway with CodeIgniter extensively? I’m trying to use Freeway to create my views and leave my code in my models and controllers the same. What I am finding is that I have to do a lot of hard-coding in Freeway for things like links and buttons instead of passing parameters from my controller. Even worse, for the variables I’m passing from my controllers, I don’t see an easy way to create php variables in Freeway. Currently I’m tagging everything I want to be a variable between my own flags ($) and then using a python script to replace these instances with a <?php> flag. This seems to work but is significantly less elegant than I would like. Even worse, I have to remember to run my script every time I play around with the site design because Freeway rewrites all the html every time I publish.

Does anyone have a good workflow for making views that play well with CodeIgniter?


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I have used CodeIgniter a little, and wrote a PHP Rails clone that borrowed some of its ideas. You might take a look at my TemplateHelper action in its Partial mode, or the version of it I wrote for use with my Generate tool. The former is at ActionsForge, the latter is on GitHub at GitHub - walterdavis/generate: Lightweight clone of script/generate scaffold for MyActiveRecord and pals

Both those Actions let you wrap your Freeway layout partials with raw code through before and after code “slots”. And you can use raw PHP in your Freeway layout if you are making a whole-page template. As long as you are only doing a one-variable substitution, you can simply put

<?= $foo ?>

in your stream of text, with no special wrapper or extra formatting, and it will just work.

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Ah, that helps. The scaffold generator is very cool and gives me a better understanding of how I might approach freeway integration. I need to brush up on my javascript to get more familiar with writing my own actions too, it seems.

One more questions if you don’t mind.

Is there a way to move the resources folder or make the reference different? I have trouble getting the views to acknowledge the existence of a Resources directory anywhere relative to where the views are. As such, if I make the Resources live at the root (and replace all my Resources links to Resources via a script) it works like a charm. Is there a better solution?


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

No, not really. The Resources folder is now and has always been a bug-bear when you need to integrate with other frameworks or even style manuals. The only change you can make to it is to either use the “single Resources folder” setting or switch to DOS mode and get singular lower-case folder name. But that’s about it. I’ve been banging the drum for more control in that area for many years, both to allow format-based subfolders, as well as renaming the folder to fit in with other systems.

Tim Plumb has written an Action called Remote Resources, and that does let you add a prefix to the path, so you could use it to re-cast the calls to another location. I don’t recall how CI’s image_path helper works, but maybe there’s a way to spoof it into always responding to a request from the application root, and just use RR to add a leading slash to the path.

Actions are incredibly powerful, and are not that impossible to master if you have done any amount of actual (non jQuery) JavaScript programming. There is also the original (Freeway 2) style of Action programming which is really more akin to XML than anything else. Less powerful, but often useful. Look inside my CrowBar Action for a good example of mixing those two metaphors.

All of my Actions are on my GitHub account, all BSD-licensed (except CalendarView, which is forced into LGPL2 by the underlying script library). Share and enjoy!

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Oh well, can’t get everything right, I guess. I suppose I’ll use my scripting solution for the time being. I’ll check out the Remote Resources action too.

Thanks for the help. Hope to be of help in the future :-).


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi LM and Walter
You can actually create a folder in the site panel (on the left side) which matches a Freeway generated folder like the css or Resources…
(I also tend to make a php folder and a js folder as well as I am always adding scripts etc. and I like to have them separated out neatly… anyway I digress)

Luckily for us freeway then uses those folders instead of generating new ones… what’s blooming handy and not really known is that if you want to you can spell Resources as resources, and freeway still thinks that’s the correct folder and chucks in the images within that folder.

You now have a set of folder which you can add scripts or style sheets into an all within Freeways own environment… Now this is where I recall a conversation I had with Tim some time back… I think he said that he had an action some where that changed the name of the resources folder on publish and freeway still honoured the new naming convention… I might be wrong but I thought that was what he said. I don’t know if this helps at all but along with the information that Walter mentioned I hope it all helps to make the workflow a little smoother.

All the best max


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Cool trick. I think it still gives me problems trying to refer to that resources folder from my framework though.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options