- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Adding php to a template
SOLVEApr 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.
Any suggestions?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
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.
I would imagine that you would want a calculator to be interactive. Pure php would still require a page load and passing data, most likely through the url, to save values. If you want a truly user friendly calculator you would want to use javascript whether your system is php or python, because javascript allows you to do on page interaction without the server having to process the inputs.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Apr 4, 2018 5:52 PM - edited Apr 4, 2018 5:53 PM
As far I can see you have two solutions:
- As it has been mention before, you can convert your PHP calculator to a javascript version and use a form to load/save the variables. If it the calculator has some steps (reloading page, different forms etc.) I suggest you to save the mid. steps in a cookie before send everything to HS in the last step.
- 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content