steps are as follows.
- add a folder in modules folder with a prefix mod example mod_myweb_advancedsearch
- add xml file – mod_myweb_advancedsearch.xml
example content of xml file. Note the admin fields can also be added here with type of field under <config>.
<extension type="module" version="4.4.1" client="site" method="upgrade">
<name>Myweb Advancedsearch for OSProperty</name>
<author>Your Name</author>
<version>1.0.0</version> <!-- This is your module's version -->
<description>Advanced Search Module for Joomla.</description>
<files>
<filename module="mod_myweb_advancedsearch">mod_myweb_advancedsearch.php</filename>
<filename>helper.php</filename>
<folder>tmpl</folder>
</files>
<config>
<fields name="params">
<fieldset name="basic">
<field name="distance_options" type="text" default="" label="Distance Options"
description="Enter distance options as comma-separated values, e.g., 10,20,30" />
<field name="instruction_text" type="editor" default="" label="Instruction Text" description="Enter the instructional text for the module." filter="safehtml" />
</fieldset>
</fields>
</config>
</extension>
step3 – add file mod_myweb_advancedsearch.php with contents like below.
This file include require_once for helper.php which is a typical backend for the module
Also this file contains links to css and Js.
and the layout file like default.php which includes all html for displaying result or collecting information using form etc.
<?php
defined('_JEXEC') or die;
// Include the syndicate functions only once
require_once __DIR__ . '/helper.php';
$document = JFactory::getDocument();
$document->addStyleSheet(JUri::root() . 'modules/mod_myweb_advancedsearch/tmpl/css/style.css');
// Example to get parameters from module configuration
$params = JFactory::getApplication()->getParams();
// Obtain a database connection
$db = JFactory::getDbo();
// Retrieve data from your helper
$searchResults = ModMyWebAdvancedSearchHelper::getSearchResults($params,$amenities);
// Include the layout file
require JModuleHelper::getLayoutPath('mod_myweb_advancedsearch', $params->get('layout', 'default'));
step4 default.php. typical content of default.php can by anything and can be very comprehensive.
- form
- displaying map using google places api
- javascript in script tag
Leave a Reply