[Pro] How to intégrale PHP code in blocks

Bonjour,

Newby to Freeway Pro, I try to integrate PHP code in blocks, I thought because we can integrate HTML, I could write as well PHP (I hope my English is fair enough to be clear).
For instance I want to access SQL database on my site.

(Sorry if the message is unreadable, I don’t know how to insert code properly in the message)

The html markup on index page is :
before :

<?php session_start(); ?>

After (connecting to db) :

<?php try { $bdd = new PDO('mysql:host=localhost;dbname=db579503772;charset=utf8', 'root', 'root'); } catch (Exception $e) { die('Erreur : ' . $e->getMessage()); } ?>

This doesn’t work : I get all the code from the sign “->” echoed on the page so I get on top of the page as an error : “getMessage()); } ?>”
This occur any time the sign “->” is in code.

you can see this her : http://s317886723.onlinehome.fr/test/index.html, if you doubleclick on the upper left corner of the window you’l see the code appearing hilited.

That’s wrong ?
I’m running through all forums and subject I can see unsuccessfully.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Are you sure your server is set up to host PHP pages? And did you change the Filename on the page from .html (default) to .php? If you don’t do that, your server will parse the page as HTML, not as PHP with embedded HTML, and so the PHP runtime will not actually be asked to interpret the code.

Walter

On Sep 12, 2015, at 4:38 AM, rick email@hidden wrote:

Bonjour,

Newby to Freeway Pro, I try to integrate PHP code in blocks, I thought because we can integrate HTML, I could write as well PHP (I hope my English is fair enough to be clear).
For instance I want to access SQL database on my site.

(Sorry if the message is unreadable, I don’t know how to insert code properly in the message)

The html markup on index page is :
before :

<?php session_start(); ?>

After (connecting to db) :

<?php try { $bdd = new PDO('mysql:host=localhost;dbname=db579503772;charset=utf8', 'root', 'root'); } catch (Exception $e) { die('Erreur : ' . $e->getMessage()); } ?>

This doesn’t work : I get all the code from the sign “->” echoed on the page so I get on top of the page as an error : “getMessage()); } ?>”
This occur any time the sign “->” is in code.

you can see this her : http://s317886723.onlinehome.fr/test/index.html, if you doubleclick on the upper left corner of the window you’l see the code appearing hilited.

That’s wrong ?
I’m running through all forums and subject I can see unsuccessfully.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

On 12 Sep 2015, 3:38 pm, waltd wrote:

Are you sure your server is set up to host PHP pages?

Yes I am : info.php says ‘PHP Version 5.6.10’

And did you change the Filename on the page from .html (default) to .php? If you don’t do that, your server will parse the page as HTML, not as PHP with embedded HTML, and so the PHP runtime will not actually be asked to interpret the code.

I’ve just done it with no success.
Anyway, thanks for help, I am sure that I’ve missed something somewhere, I am going to work a little bit more on manuals and other stuff.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Change the suffix of the page(s) from .html into .php

Richard


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

I did, see my previous post.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Thank you Walter, the code doesn’t appear anymore on top.
I still have a long way to run before I could master this correctly.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Sorry about that … post was waiting for me to ‘submit’ … Walther already responded before I remembered to deliver the goods :slight_smile:


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

On 12 Sep 2015, 5:05 pm, rick wrote:

Thank you Walter, the code doesn’t appear anymore on top.
I still have a long way to run before I could master this correctly.

You guys sometimes have a very interesting sorting order how to challenge web-projects.

I mean, it’s a crazy cool approach to directly fire into the “dynamics” such as php and calling stuff from MySQL and so, but allow me a small note here:

Doing “dynamic” comes from proper “static”.

Perhaps you are interested how your static currently is looking like? Here we go:

You can see, even without php it’s already “very dynamic” - maybe not the way you intended, who knows?

Cheers

Thomas


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

sglups !

I’ve never seen this. I am going to rebuilt this from scratch.
I need a dynamic site, but I know, like I said in a previous post here, it’s long way to master freeway.
Anyway, I have plenty of time…

Thanks for the info. I have to work hard.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

What I would do then is leave all design out and start by all minimum required items and stuff. Furthermore start very, very static (center page).

While I’m not aware what specifically you’re after, and while I’m not aware of PHP at all, I’d have as well a look at the forge http://actionsforge.com which is the place for actions helping you out (in some cases). Perhaps there is an out-of-the-box thing such as connecting to MySQL:

http://actionsforge.com/actions/mysql-connect

Sometimes, it’s even better so seek for “entire” off-board solutions elsewhere (ready to roll php-scripts).

Finding the correct places for code-snippets may be a challenge, too. It requires a minimum understanding of the page-structure. I once did a lil series of videos, trying to cover those aspects. This is the episode about places and stuff:

http://www.kimmich-digitalmedia.com/videos/010_thecodingepisodes_part3_the-skeleton-web-page

So if function first - do function first, design is another discipline (that should already exists) and can be introduced later (this is my preferred modular thinking).

Cheers

Thomas


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Have also been looking at a members login and found this one which is easy to install once you have created a database on your server / web host.

http://usercake.com/docs.php

At the moment I just need to alter the usercake template.php to match my freeway site.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Thanks to Thomas and Matt for their posts.
I got a lot of work :wink:

I looked at kimmich-digitalmedia.com and found good infos to go on building what I want.

Could you , Matt, tell me how to integrate usercake to freeway.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Hi Rick,

At the moment I have had to get on with another project and have only tested setting up on hosting and checked it all works.

I am looking to change the site-template css in the - userCakeV2.0.2/models/site-templates/default.css to reflect the php pages I upload from freeway.

In my freeway pages add the code from “How do I create a secure page?” in the before

As I say haven’t tried any of this yet but thought Usercake may be of some interest!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

If you got a lil budget, have a look at http://www.vibralogix.com/sitelokpw/

For Sitelok, there is a Freeway Documentation which will mean, that you add function(s) specifically to your page, rather wrapping functionality by design. Perhaps the easier way.

Cheers

Thomas


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Brilliant Thomas looks by far the easiest option!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

On 14 Sep 2015, 1:26 pm, Matt wrote:

Brilliant Thomas looks by far the easiest option!

Yes, I had a look, and it seem’s to be true, Matt. Thanks to Thomas.
I think I’m gonna take this last option and maybe, for design purpose, the lounge at your’s, Thomas.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

I had a look to SiteLok and … yes, true, thanks to Thomas.
I think I’ll take this last option and maybe, for design purpose, join your lounge, Thomas.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

the double post is a mistake, my head is out for lunch :wink:


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options