[Pro] Some of my problems inserting dynamic code into a FW doc

Some of the problems I encountered when inserting EE code into FW documents. I am still talking FW 5.5.x here, btw.

My workflow is to separate database from design. The FW generated HTML files pass through the EE parsing system. I do not complain about the ease I can work with the app. FW is very stable, uploading is fast. It is just the interface and CSS system that bothers me. And the general view of what I do is gone so Imust publish in TextWrangler to see what happens.

For starters, when applying the folder action from the EE suite, path settings are changed in the black box (=the publishing of FW)
This makes it impossible to externalize styles with actions like externalizer. My designer does not like this.

(I heard that this is solved in FW6, did not yet test this out)

In EE I can call anything I want through the URL. This makes, for instance, changing META tags a breeze. But in FW it is very hard to add the needed code into tiny little input fields from actions like Dynamic Page Titles. Or some of Meta Plus.

I could even call different stylesheets. But in FW it is impossible to change the URL of the main stylesheet.

I usually take pages apart. Pieces like nav divs and footers are inserted in the Templating system of EE through snippets. Parsing order is important here, as well as performance. In FW my styles gets lost if I do not publish them anymore, which happens if I take pages apart. I solve this with external stylesheets. Now my styles are partly in the main stylesheet, partly in the body tag, partly in this external stylesheet. Bad for maintenance…

(This is written from memory, maybe more to come…:wink:


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

Although EE and MODX do their thing differently I have a similar issue with resource paths (discovered when putting together my MODX/Freeway demo http://xiiro.com/musings/2013/02/05/modx-freeway/) when using Freeway’s external stylesheets. As it stands currently the only way around it (for me) was to include the CSS in the head tag. Far from ideal, obviously.

Todd

RSS: http://xiiro.com/musings/feed.rss

For starters, when applying the folder action from the EE suite, path settings are changed in the black box (=the publishing of FW)
This makes it impossible to externalize styles with actions like externalizer.


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

I don’t use EE but here are some answers that might help.

I have an action called PHP Dynamic Page titles, I can send a copy to you if you want.

For example:

  1. Apply action to page
  2. Write a PHP variable name in the field, say ‘$dynamicTitle’
  3. Select if you want to use this variable content a) By it’s self b) Before the actual FW title or c) After the actual FW title
  4. Now you can set the content for ‘$dynamicTitle’ at the top of the page or in the include script for that page.
<?php
$dynamicTitle = 'This is my text';
?>

I find this useful when using sites for two languages but one FW page

<?php
if ($uLang=='ES') {
  $dynamicTitle = 'Este es mi texto';
} else {
  $dynamicTitle = 'This is my text';
}
?>

You can use this in whatever way it suites your needs.

I tend to just add custom stylesheets at the top of the page then write them on the server, FW then uses the styles it creates and you can set the styles you want to outside of FW.

You can get around the last thing you mention on styles by adding the custom stylesheet, you can also place a styles item above your page content and apply the style there, FW will then add it to the page,personally I prefer to add a custom style sheet.

HTH

On Mar 17, 2013, at 5:17 PM, atelier wrote:

Some of the problems I encountered when inserting EE code into FW documents. I am still talking FW 5.5.x here, btw.

My workflow is to separate database from design. The FW generated HTML files pass through the EE parsing system. I do not complain about the ease I can work with the app. FW is very stable, uploading is fast. It is just the interface and CSS system that bothers me. And the general view of what I do is gone so Imust publish in TextWrangler to see what happens.

For starters, when applying the folder action from the EE suite, path settings are changed in the black box (=the publishing of FW)
This makes it impossible to externalize styles with actions like externalizer. My designer does not like this.

(I heard that this is solved in FW6, did not yet test this out)

In EE I can call anything I want through the URL. This makes, for instance, changing META tags a breeze. But in FW it is very hard to add the needed code into tiny little input fields from actions like Dynamic Page Titles. Or some of Meta Plus.

I could even call different stylesheets. But in FW it is impossible to change the URL of the main stylesheet.

I usually take pages apart. Pieces like nav divs and footers are inserted in the Templating system of EE through snippets. Parsing order is important here, as well as performance. In FW my styles gets lost if I do not publish them anymore, which happens if I take pages apart. I solve this with external stylesheets. Now my styles are partly in the main stylesheet, partly in the body tag, partly in this external stylesheet. Bad for maintenance…

(This is written from memory, maybe more to come…:wink:


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


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

Hi Mike

About your action (thanks for the offer) your PHP Dynamic Page titles uses if/ ifelse, something that is native to EE (runs on Codeigniter). But I doubt if this could be is a solution. First I must set my Template to be able to use input PHP, then I end up using advanced conditionals in EE ( if/ifelse is advanced) which get parsed last.

I point to external style sheets in the /HEAD very often. For example when using a Lightbox or other fancy stuff on the page. But that is a bit my point. The CSS christmas tree becomes uncontrollable, just because stylesheets are everywhere.


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

Sorry, I didn’t realise that it was Expression Engine that you where using, I just use PHP scripting and communicate with the MySQL databases that way so implementation is obviously a lot easier as I am not forced to jump through more hoops that I already have to.

This method doesn’t make me put style sheets everywhere so I can just put them in the same place on the server as FW does.

From what I understand then EE is possibly the source of your issues, not FW :wink:

On Mar 17, 2013, at 6:4 PM, atelier wrote:

Hi Mike

About your action (thanks for the offer) your PHP Dynamic Page titles uses if/ ifelse, something that is native to EE (runs on Codeigniter). But I doubt if this could be is a solution. First I must set my Template to be able to use input PHP, then I end up using advanced conditionals in EE ( if/ifelse is advanced) which get parsed last.

I point to external style sheets in the /HEAD very often. For example when using a Lightbox or other fancy stuff on the page. But that is a bit my point. The CSS christmas tree becomes uncontrollable, just because stylesheets are everywhere.


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


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

Joe Muscara wrote some Actions for the original EE, not the newer CI version, and they did have to jump through some clever hoops to get the image references to be correct for EE’s notion of a site path. I believe they may still work with EE Core, I thought he posted recently that they did work.

Walter

On Mar 17, 2013, at 1:21 PM, Mike B wrote:

Sorry, I didn’t realise that it was Expression Engine that you where using, I just use PHP scripting and communicate with the MySQL databases that way so implementation is obviously a lot easier as I am not forced to jump through more hoops that I already have to.

This method doesn’t make me put style sheets everywhere so I can just put them in the same place on the server as FW does.

From what I understand then EE is possibly the source of your issues, not FW :wink:

On Mar 17, 2013, at 6:4 PM, atelier wrote:

Hi Mike

About your action (thanks for the offer) your PHP Dynamic Page titles uses if/ ifelse, something that is native to EE (runs on Codeigniter). But I doubt if this could be is a solution. First I must set my Template to be able to use input PHP, then I end up using advanced conditionals in EE ( if/ifelse is advanced) which get parsed last.

I point to external style sheets in the /HEAD very often. For example when using a Lightbox or other fancy stuff on the page. But that is a bit my point. The CSS christmas tree becomes uncontrollable, just because stylesheets are everywhere.


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


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


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

I thought he posted recently that they did work.
Yes I know, it is just me that did not have the time to test FW6.

so I can just put them in the same place on the server as FW >does.

From what I understand then EE is possibly the source of >your issues, not FW :wink:

I did not say that FW did not put CSS on the server at the same place as FW does. Thanks to the Action of Joe Muscara this has been taken care of.

I only mentioned some of the problems I experience with FW. I feel the app is in the way. Does not give me ‘the whole view’. And does not do certain essential things at all because of the it’s nature. Unfortunately I must say, because I like FW and the community around it.


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

sorry, something went wrong here.

Reply to Walther should have been like this:

I thought he posted recently that they did work.

Yes I know, it is just me that did not have had the time to try FW6.


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

Sorry, I understood you said the style sheets where ‘everywhere’.

In all honesty FW is not specifically made to do what you are doing, nor do I think it was written to do specifically what I use it for but because PHP is a basic server-side scripting language it can be implemented reasonably easily into FW, what you are trying to do is a bit like trying to fit a Rover engine into a JetSki, it can work but they are not made for each other so it’s going to take a lot of work with a crow bar and anything else you can find to get it in there :wink:

I not sure I really understand if when you say it “doesn’t do essential things because of its nature” is related to using it with EE or do you mean just in general? I understand many peoples gripes as I say I have many too but not being able to use it easily with something it wasn’t made to be used with is well something that would be fairly much expected… unfortunately.

I am not sure how EE works or to what extent Joe went to on his actions but maybe it could be worth the effort to expand on those actions to do what you need doing, even for the simple things that you do a lot, actions can speed that side up also. I know that writing actions can take a lot of time but they can also save a lot of work once you have them, who knows, you might even be able to sell them and try getting some returns on your efforts financially.

You know I often smile to myself when I remember how happy it made me to have found FW back in FW2’s days, at last I could make my web site so easily, quickly and it just worked (and quite a few in it for friends that the pros couldn’t get to work), I thought what a great application… brilliant! Then as time went on I wanted more, I needed more but as I did I also realised those things that made me so happy with Freeway started to annoy me as I discovered it was made for people like me ‘when I found it’, not for people like me who wanted to write code in it or use it with dynamic data, I came across so many idiosyncrasies and pot holes that it drove me mad. I guess being able to think back to those early days actually help me plough on, also thinking of what the alternatives might be… :slight_smile:

If you use FW with EE that much maybe looking into the action side would be worth your while.

Mike

On Mar 17, 2013, at 10:43 PM, atelier wrote:

I thought he posted recently that they did work.
Yes I know, it is just me that did not have the time to test FW6.

so I can just put them in the same place on the server as FW >does.

From what I understand then EE is possibly the source of >your issues, not FW :wink:

I did not say that FW did not put CSS on the server at the same place as FW does. Thanks to the Action of Joe Muscara this has been taken care of.

I only mentioned some of the problems I experience with FW. I feel the app is in the way. Does not give me ‘the whole view’. And does not do certain essential things at all because of the it’s nature. Unfortunately I must say, because I like FW and the community around it.


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


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

In all honesty FW is not specifically made to do what you are >doing,

Same thought occurred to me…:wink:

“doesn’t do essential things because of its nature” is related >to using it with EE or do you mean just in general?

In general. Example? Think of changing code in a Crowbar (or some Extended Dialog Window) that sits in 15 pages. I must first open the page (in left-pane), find the Crowbar, open the dialog window, past my code, close the window, close the page. At least 6x15 mouse clicks.
Compare that to one find-and-replace for the whole set of HTML files.
FW cannot do that, because of the nature of its construction.

That’s why I feel I am about to change horses.

Ah, sometimes I feel so ungrateful. But I am not. I still think of FW as a brilliant piece of software. And the community, helping each other. Some very active members writing Actions, most of them for free! Where else do you find this?


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

So if the code you have on some area of multiple pages is something that you feel will/might change 'I know, you might not know that at the outset but if you did) then can you not write the code snippet in EE friendly code in say a file maybe called ee.dialog.inc (or whatever) then include it on the page or the area that code is written, so when you need to change that code snippit you just jump into the server and alter the contents of inc.dialog.php … for example.

On Mar 18, 2013, at 12:6 AM, atelier wrote:

In all honesty FW is not specifically made to do what you are >doing,

Same thought occurred to me…:wink:

“doesn’t do essential things because of its nature” is related >to using it with EE or do you mean just in general?

In general. Example? Think of changing code in a Crowbar (or some Extended Dialog Window) that sits in 15 pages. I must first open the page (in left-pane), find the Crowbar, open the dialog window, past my code, close the window, close the page. At least 6x15 mouse clicks.
Compare that to one find-and-replace for the whole set of HTML files.
FW cannot do that, because of the nature of its construction.

That’s why I feel I am about to change horses.

Ah, sometimes I feel so ungrateful. But I am not. I still think of FW as a brilliant piece of software. And the community, helping each other. Some very active members writing Actions, most of them for free! Where else do you find this?


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


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

Ah, I understand.

I know about snippets. Use them all the time. This is about something else.

EE works with ‘tags’. These tags are part of a large ecosystem and work together. Each tag performs a certain task in the parsing process. Let’s say the server gets a request for a page. The server sends this request to the EE system. One of the great powers of EE is that elements in the URL determine what EE shall do with (=put into) the page. For example:

my_site.com/index.php/EN/my_template/success.html

calls the file my_template. What about the succes and EN part? I coded EE tags in my_template (which is of course a page in a folder in my FW setup), and these tags pull the content from the database.

And soon as ‘success’ appears as segment 3 in the URL, EE injects content that belongs to a story about success (because the entree has as title ‘success’). The EN part? I told the page to listen to segment 1. EN means: you are now in the English section of the website. The visitor can of course switch between language sections. How does this work in EE? I did not code this as if/ifelse conditional. In stead I name my fields EN_text and SE_text. And in the page: {{segment_1}_text}. EE puts automagically segment 1 where I want it.

Now back to FW, and my crowbar. Or Extended Dialogue. Think of me making some mistake in my code, or I change my mind, and want to alter some of that particulair code in all of my 15 FW pages. These are not snippets that live on the server, but code that is embedded inside FW pages. As I said, I often work with snippets, they are easely changable as you say. But I cannot use them always.

EE is really a nice system, you should try it one day :wink:


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

In all honesty just using PHP scripts along with MySQL is a nice system, I cant see how a template system could improve on that for me.

I had a developer do a site for me quite a few years ago, they did it with smarty and EE sounds very similar… absolute nightmare when you want to change anything but one of the things I did was to add the changes with little bits of Smarty code and pull them into the pages and that was not using FW but I can see how I might have done it with FW.

{{segment_1}_text}. EE puts automagically segment 1 where I want it.

For example I add

<?php
echo $copyRight;
?>

…to the bottom of pages in a site but do a little work in a script to get the content of $copyRight, so I just add that to a file then include it at the bottom of my page, can you not put the code with {{segment_1}_text} in a file and pull it in, so it you want to change it on all the pages you just change the one file on the server? I think that would have worked for me on smarty if I called the page ‘something.tpl’, EE sounds like it works in a similar way.

I remember when I started to delve into make changes on smarty I just experimented to get the little bits of code into the page, it took quite a lot of time but I eventually found a way that smarty would work and that I could change sections easily, I used to curse it but people used it and said they liked it. I am sure if I knew how to use it properly it might have worked for me better but it was built to work a certain way while I was trying to make it do things my way… I finally decided smarty had to go and that I would work ‘my way’ so started to rewrite the site in FW, php and MySQL… unfortunately it is a large site and makes quite a few calculations so it will take a while but at least once done I will be able to make my changes easily and not worry that what I am doing smarty won’t like.

EE is really a nice system, you should try it one day :wink:

That smarty web site seemed like a really nice system at the outset but I think I will stick to my way of doing things, especially if it is giving you headaches. :slight_smile:

On Mar 18, 2013, at 1:18 AM, atelier wrote:

Ah, I understand.

I know about snippets. Use them all the time. This is about something else.

EE works with ‘tags’. These tags are part of a large ecosystem and work together. Each tag performs a certain task in the parsing process. Let’s say the server gets a request for a page. The server sends this request to the EE system. One of the great powers of EE is that elements in the URL determine what EE shall do with (=put into) the page. For example:

my_site.com/index.php/EN/my_template/success.html

calls the file my_template. What about the succes and EN part? I coded EE tags in my_template (which is of course a page in a folder in my FW setup), and these tags pull the content from the database.

And soon as ‘success’ appears as segment 3 in the URL, EE injects content that belongs to a story about success (because the entree has as title ‘success’). The EN part? I told the page to listen to segment 1. EN means: you are now in the English section of the website. The visitor can of course switch between language sections. How does this work in EE? I did not code this as if/ifelse conditional. In stead I name my fields EN_text and SE_text. And in the page: {{segment_1}_text}. EE puts automagically segment 1 where I want it.

Now back to FW, and my crowbar. Or Extended Dialogue. Think of me making some mistake in my code, or I change my mind, and want to alter some of that particulair code in all of my 15 FW pages. These are not snippets that live on the server, but code that is embedded inside FW pages. As I said, I often work with snippets, they are easely changable as you say. But I cannot use them always.

EE is really a nice system, you should try it one day :wink:


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


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

The whole idea of Smarty is to separate logic from presentation. It’s a safety measure more than anything else. Regular “spaghetti” PHP encourages you to put logic (database access, filtering, transformation) into the HTML, intermingled in a difficult to follow and potentially unsafe manner. Smarty is harder to get working with at first, but it enforces some rigor in your practice. About the only “smart” thing you can do in Smarty is loop over a collection of objects and display them. You cannot go off to the database, find more of them, alter that collection, etc. You have to do that somewhere else, hopefully in a file that only contains logic. The goal is to centralize authority, so you only have to look one place to close a security hole or fix an error in logic, rather than hunting and pecking through hundreds of disconnected files that all repeat the same sorts of things.

Rails (which wins all sorts of awards for application design) does the same thing with its views. At their best, they are pure “dumb” templates, capable of converting a collection of objects or a single object into HTML (or JSON or CSV, or any other format you need). Any logic related to marshaling that collection or finding that object belongs in the controller, which itself knows nothing of the database (or even if there is one). The controller asks the model, the model returns objects, the controller passes them to the view, and you get what you asked for.

Walter

On Mar 18, 2013, at 4:06 AM, Mike B wrote:

That smarty web site seemed like a really nice system at the outset


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

I found I ended up pulling my hair out over smarty, the logic seemed great at the start but very soon I got a real dislike for it. It was the simple changes I wanted to make that I found could turn out to be complicated.

Horses for courses I guess, depends what side of the bed you sleep on etc. :slight_smile:

On Mar 18, 2013, at 2:1 PM, Walter Lee Davis wrote:

The whole idea of Smarty is to separate logic from presentation. It’s a safety measure more than anything else. Regular “spaghetti” PHP encourages you to put logic (database access, filtering, transformation) into the HTML, intermingled in a difficult to follow and potentially unsafe manner. Smarty is harder to get working with at first, but it enforces some rigor in your practice. About the only “smart” thing you can do in Smarty is loop over a collection of objects and display them. You cannot go off to the database, find more of them, alter that collection, etc. You have to do that somewhere else, hopefully in a file that only contains logic. The goal is to centralize authority, so you only have to look one place to close a security hole or fix an error in logic, rather than hunting and pecking through hundreds of disconnected files that all repeat the same sorts of things.

Walter

On Mar 18, 2013, at 4:06 AM, Mike B wrote:

That smarty web site seemed like a really nice system at the outset


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


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

I too once looked into Smarty but not for love nor money could I get a handle on it. A lot of job listings I find require it so I thought I should see what it was about. A short-lived trip that was.

Todd

The whole idea of Smarty is to separate logic from presentation.


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