An idea for Pinegrow 3 an PHP

Hello,

I have just checked your major .04 update and it is really good!

Last week I ran into a problem where I thought my design would be final and added a lot of PHP to a file. I then realised that I had to rework certain areas of the pinegrow template and had to bring back the code for further design, the problem is that I had only 2 options:

Either output the website html code and copy all the html output in pinegrow
or
remove all the php and import it that way.

Something that would be fantastic(no idea if it is technically possible from your side) is a way to “lock” the PHP on a page by creating zones. IE: If a loop is inside a table, a special class in that table will tell pinegrow “hey do not touch it via drag and drop, there is php in here”.

When we hover the divs a new option shows as “PHP LOCK” and then this area must then be edited in the code editor(no more drag and drop that breaks a loop for example).

Will you ever add more php features like “echoing the php” rather than echoing the synthax. It would enable people to simply drop the design here and work directly on the hard coded version which could be really useful in many case.

Thanks.

Answer:

Try this and see if it works for you.

Page -> Manage libraries & plugins…

Activate Server-side Scripts

A new menu will appear at the top of the Pinegrow window. PHP, ASP, ERB
Deselect Show Server Side Code

See if that does not do what you want.

http://docs.pinegrow.com/editing-php-html-templates/

— Original Post ------

This sounds more like a design issue with your html than with Pinegrow. You really should not intermingle php with html.

The html should be on it’s own without much server side scripting in it if you can help it. There are many ways to create templates on the fly, though if you have to have php in the html then grab the processed version directly from your testing server instead of working on the raw files themselves.

I have the luxury of creating my own solutions, if you are using Wordpress, Joomla or some other 3rd party CMS you are stuck with how they operate. In general the cleaner you can keep things, separating the logic from the design layout for instance the better you will be when it comes to troubleshooting and upgradability.

Hi Terry,

I am not sure I understand.
Yes I do need php in my files, especially when I have tables.
My PHP in Pinegrow shows as “text” and is not being hidden, this was my issue.

Hope you understand.

Thanky ou.

I understand your problem and it is the way that Pinegrow works. It is not a code editor for PHP, it is a front end designer making all the pretty and content presentation stuff that the end user sees and interacts with. All the server side programming stuff is outside the purview of Pinegrow and should as I suggest be separate within your code as well.

It does take rethinking the design of your site and how your code works to accomplish. To generate the output without server side code being within the HTML.

In Templates I design I use keywords or special tags that get replaced with generated content. The templates are 100% Html with no code, php in them at all. When you look at the php code there is no htrml there either, just a bunch of rules for creating the output in the format required. I save the final output to static html pages and just update them as content is updated. Makes things run smoother and pages load quicker than having to process everything at each page request. To make the code so it is not dependant on a specific theme or template does take some thinking but is worth it.

That is one way I do it. Gives you an idea that it is not necessary to have everything in one file. I program using OOP so I have classes that do the necessary work and makes things easier to maintain.

If the problem you are having, with not being able to separate the html from your code is getting in your way then you will need to grab the final output generated and work with that within Pinegrow. Then break it a part and reinsert your php code where it needs to go once the design is the way you want it.

Hi Terry,

The way my code works is this way(pretty standard):

In the root I have all my main php files, ie: index.php, contactus.php and aboutus.php

In each file I have the header.php, nav.php and footer.php as includes.

I understand that certain frameworks instead prefer to pass everything into the index.php and from there have some kind of templating system in it but still, in symfony 3 for example, you would still have Twig as the template engine and this is php or “an unknown code in Pinegrow”.

I understand this is not a PHP editor, all I was asking was that it would have been nice to have the software recognizing at least the “<?php ?>” tags and hide whatever code is in it instead(and even protect the code by locking it) of outputting it it as “text” in pinegrow. I understand that it would not be right for Pinegrow to process the logic of the PHP code as it means too much work for the pine grow team but at least hide the “unknown code” by simply recognizing certain given tags.

ie: An area in Pinegrow where we can input the start and end tags we would like the software to recognize and hide.

I give you a simple example of many templates you will buy online.

You have a contactus.php coded in procedural PHP with 3 or 4 includes(footer, header and more), let’s say you wish to change its design, each time you have to output the html, get this into Pinegrow and then re-attach the PHP code, a lot of work for nothing. If instead the PHP code was simply hidden and locked in Pinegrow itself, this would enable me to keep all the includes, change the layout and then upload the file right away.

It was just an idea as I have seen similar coding idea in another design software that’s all.

I get it. What you describe is really a bad design and should be avoided as a bad practice in regards to software design. Everything should be separate especially the front end layout from the back end logic. I wish programmers would stop creating things that way.

The problem lies in the code, when you mix the front end pretty with the backend code there are many many different ways this can be done. If you have vital parts of the html within the <?php open and close then what you describe would break the layout. If you just have php includes then you are missing entirely the html that is suppose to be included. You are working with an incomplete html page. Which after you make your changes then load the page it may work it may not.

The best way to work with systems like what you are talking about is to take the final output and bring that directly into Pinegrow.

I fully understand what you are saying and wanting, if you search through the forum you will find others asking for the same thing. You are not alone. What I am suggesting is that this way of making CMS software is really a bad idea and is a poor practice. It goes against basic software design principles. I obviously have a bias when it comes to this way of designing content management systems. Which is why I create my own.

There are many ways that code is intermingled with html and it is difficult to create a filter to remove all the ways this can occur and still make the html page display as intended.

Enough said on that.

If you can post a sample of what you are seeing in your Pinegrow with the template you are using I maybe able to suggest some ideas to remove the PHP or one of the developers can take a look and see what they can do. You may want to post to the feature request section with the sample template you are working with also.

Thanks Terry for the reply.

Yes it depends on the project and cost.
I don’t mind oop and complex routing + full templating engine but on project that cost 150 dollars each, I just do not have the time to setup a framework and spend 2 weeks to build the site, this is why many coders cannot always follow all the rules, if we do, we lose time and money. I tried building things the right way for small projects and got tossed with the final bill and lost customers. It is difficult.

But yes I totally understand what you mean. I give you another example, I program music and sometimes complex cinematic scores, when a customer pays well, I master the whole lot using top plugins which require extreme care when used, when they pay less, I just cannot afford to be picky and export the product mastered with cheaper plugins, otherwise I just can’t survive. But we understood each other on this:-)

So really I was looking at Pinegrow being able to work with both worlds(proper coding and easy/quick coding)

I have taken a screen picture, please see what I meant:

And yes soon I will post it in the suggestions, thanks.

Go to the Tree, select the line it is on and click the eye with the line through it and it will hide the line.
You can also select multiple lines and do the same thing.

Though if the line contains any tags required to display the page correctly then you are turning those off and breaking the page.

If you are dealing with customers that are using a specific CMS other than wordpress Pinegrow is more than likely not going to be able to work with those templates. The fastest way that I know of is to like I said import the generated page, make any changes you need then break it a part and place into the template pages directly. There really is no shortcut in this situation.

Try this and see if it works for you.

Page -> Manage libraries & plugins…

Activate Server-side Scripts

A new menu will appear at the top of the Pinegrow window. PHP, ASP, ERB
Deselect Show Server Side Code

See if that does not do what you want.

http://docs.pinegrow.com/editing-php-html-templates/

1 Like

Yes!!!

That’s the one Terry!! thanks.

This is exactly what I was looking for, can’t believe it was there and I did not see it…:frowning:
This will be of a great help as I can now look at the pages without having the php in the way, superb!!

Thanks again and enjoy your week end

1 Like

Well Done @Bennyboy.
A pity that wasn’t the first reply
:wink:

That’s all good Schpengle, Terry did a superb job!

Thanks again to him!

Probably because I did not know about it because this issue is not something I am personally impacted by. I finally went looking and found the solution to @Bennyboy’s “problem.”

In general though this should not even be an issue but Pinegrow developers see that it is and created something that does what is needed. Which I did not know about or at least did not remember from my initial exploration of the program back when I first bought Pinegrow late last year.

and there that jokey reply is…gone!

woops! I thought I was replying to an email there! I didnt know it would appear here. lets just delete that then :slight_smile: Humour doesn’t always scale very welll…

You do realize that posts go to everyone’s email that has the settings to receive email on new posts right? They do not have to be following a specific thread to get the email from my understanding. Your jokes have a wide audience whether the posts are removed or not.

I understand your view. At the time I did not know there was a solution when I discovered it I posted. It makes sense that Pinegrow was given the ability to filter out non-html code and it is helpful I agree. My views on separation of programming logic from presentation is valid though apparently not something many follow, thus the feature we discovered.

I appreciate your input.

woops! Now I know :slight_smile: I have mine set to just receive emails mentioning/sent to me.
I’d have thought that’s what most people set it too to stop us getting bombarded by lots of post! my dumb jokes included :slight_smile:

in other news, did you see that 100GB free storage deal I just posted Terry? I just signed up. I hate the cloud! it is basically data mining all our information for nefarious groups, but, you never know when you might just need it for something innocuous but large!

1 Like

Thanks again for everything Terry.