If you need to make modifications to a package you should not modify the core package code, you can safely modify the package in your apps/Packages
folder.
Following these steps will allow you to update the package in the future but still keeping any overrides that you have made.
In this example we are working form the "ExampleContactForm" package.
To add extra information to the thank you page follow the below steps:
apps/Packages/ExampleContactForm/Views
packages/ExampleContactForm/Views/thankyou.tpl
into your apps/Packages/ExampleContactForm/Views
folderthankyou.tpl
file adding in the below code as the last line <p>Please continue to browse our <a href="http://{setting:SITE_HOST}/">website</a>.</p>
Now when navigating to /contact/thankyou
on your website you will see the extra text we have just added
Now we are going to add an 'city' field onto the contact form, to do this we will need to edit the Contact.model.php
model and also add the new field to the form.tpl
view.
First we are going to add extra field to the model:
apps/Packages/ExampleContactForm/Models
packages/ExampleContactForm/Models/Contact.model.php
into your apps/Packages/ExampleContactForm/Models
folderContact.model.php
file, we are going to replace the validate()
function with the below code<?php
public static function validate(){
$blStatus = false;
return $blStatus;
}
Next add the new field to the form.tpl
view:
apps/Packages/ExampleContactForm/Views
(if you have not already)packages/ExampleContactForm/Views/form.tpl
into your apps/Packages/ExampleContactForm/Views
folderform.tpl
file, we are going to add the below line of code after the name field: <label>City</label><input type="text" name="city" value="">
Now when navigating to /contact
on your website you will see the new field on the form, when the form is filled out you will also see the extra field listed in the alert email.