Adding php to a templateSOLVE
Apr 3, 2018 11:47 AM - edited Apr 3, 2018 11:48 AM
I've created a php/jQuery form that calculates repayments. I've tested this using a simple php page and it all works. I now need to import the code onto the appropriate template but there doesn't seem to be any way to edit the template code.
I also need to add all the CSS to the template but I can't find the stylesheet anywhere.
Solved! Go to Solution.
Apr 4, 2018 5:03 PM
I say this as well "You can't use server side code in Hubspot" but the truth is that HubL is server side code. You are used to php, I would imagine WordPress, right? WordPress is build in PHP and uses a custom version of PHP for templating. Hubspot is built in Python and uses a custom version of python, HubL (similar to jinja, django templates, or other python templating languages) for templating.
While it is true that, unlike WordPress or other self hosted content management systems, you cannot access the systems core, you can still do quite a bit with HubL, especially now with the new custom modules setup.
There are some limitations here, but that goes for any cms. before careful not to write something off as a limitation when it is actually just requiring a python friendly solution. PHP and Python are totally different languages. teamtreehouse.com has a great python course that honestly goes a long way in helping you understand the concepts surrounding Hubspot's HubL.
Apr 4, 2018 5:52 PM - edited Apr 4, 2018 5:53 PM
As far I can see you have two solutions:
- But as you already have the calculator working in PHP I would suggest just use an external hosting (if you own one) for that and use AJAX for those external call. That should work fine to keep everything working without re-do stuff.
Regarding the CSS: you need to create a custom CSS file. Add the styles there and then you should be able to attach files to templates (recomended).
If you want to add the same for all the pages (even landing, thanks etc.) and put something as "global" you can go to content -> content settings-> site header HTML (or footer) and add there all you need.