In this article I'd like to talk about the get_property_module_data function.
Introduction
As with most things in Jomres, this function started out with humble beginnings, but it has evolved to play a crucial role in how Jomres works.
As of Jomres 10, it is used by many different plugins to produce output on pages. From the Extended Maps plugin, to the Property Grid plugin to others, it's used extensively to display an individual property's details within a template.
Take a look at the fuction's contents on github https://github.com/WoollyinWalesIT/jomres/blob/master/libraries/jomres/functions/get_property_module_data.php
It's called thus :
$module = get_property_module_data( array(1) );
When called the function receives an array of property uids (mandatory), and optionally a path to a template file, and a template file name. If these options aren't used Jomres will use basic_module_output.html ( for example here ) to produce the layout. It returns both the rendered template file and also the data that was used to construct that output, in an array indexed on the property uid.
What it looks like
The default basic_module_output.html template file's output is relatively simplistic. This is purely for aesthetical reasons but a considerable amount of information is available to the template file, a variable dump of which you will find at the end of this article. Any of that information can be used in a template file that this function calls, so if you wanted to output the town in the template you would just put {PROPERTY_TOWN} and voila! you have your output. (the capitalisation is important).
Both Extended Maps and the Property Grid plugins use their own template files to render this output. The Extended Maps google maps info window doesn't support the use of modals, and Property Grid because different sized images benefit from slightly different markup in the template file.
Can I customise the function?
Sure!
This function is kept in it's own file get_property_module_data.php which in turn is included in the system by the j00001functioncall_get_property_module_data.class.php script. This means that you can copy the file to a new location (e.g. /jomres/remote_plugins/custom_code), copy the j00001 script to the same (or another) location and when you edit the j00001 script to point to the new function file's location you can then safely modify this function to suit your own needs.
Data dump of values available to the called template file :
array(73) {
["published"]=>
int(1)
["propertys_uid"]=>
string(1) "1"
["property_name"]=>
string(12) "Hotel Olivia"
["property_street"]=>
string(11) "Asheldon Rd"
["property_town"]=>
string(7) "Torquay"
["property_postcode"]=>
string(7) "TQ1 2QS"
["property_region"]=>
string(9) "Andalucia"
["property_region_id"]=>
string(3) "985"
["property_country"]=>
string(5) "Spain"
["property_country_code"]=>
string(2) "ES"
["property_tel"]=>
string(12) "01000 123456"
["property_fax"]=>
string(12) "01000 654321"
["property_email"]=>
string(13) "This email address is being protected from spambots. You need JavaScript enabled to view it."
["ptype_id"]=>
int(1)
["property_type"]=>
string(14) "propertyrental"
["property_type_title"]=>
string(5) "Hotel"
["stars"]=>
int(3)
["superior"]=>
int(1)
["lat"]=>
string(10) "51.5006800"
["long"]=>
string(10) "-0.1431700"
["metatitle"]=>
string(0) ""
["metadescription"]=>
string(0) ""
["metakeywords"]=>
string(0) ""
["property_features"]=>
string(27) ",32,34,35,30,40,41,4,77,47,"
["property_mappinglink"]=>
string(0) ""
["real_estate_property_price"]=>
string(1) "0"
["property_description"]=>
string(445) "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
["property_checkin_times"]=>
string(445) "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
["property_area_activities"]=>
string(445) "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
["property_driving_directions"]=>
string(445) "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
["property_airports"]=>
string(445) "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
["property_othertransport"]=>
string(445) "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
["property_policies_disclaimers"]=>
string(445) "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
["apikey"]=>
string(50) "lXXSrzGDuFGoSkatqbBTgByaSCxMATTtqkzGZitBKtpsFHFHcz"
["approved"]=>
int(1)
["permit_number"]=>
string(0) ""
["completed"]=>
int(1)
["cat_id"]=>
int(1)
["rooms"]=>
array(12) {
[1]=>
string(1) "1"
[2]=>
string(1) "2"
[5]=>
string(1) "5"
[6]=>
string(1) "6"
[7]=>
string(1) "7"
[8]=>
string(1) "8"
[9]=>
string(1) "9"
[10]=>
string(2) "10"
[11]=>
string(2) "11"
[12]=>
string(2) "12"
[13]=>
string(2) "13"
[14]=>
string(2) "14"
}
["room_types"]=>
array(2) {
[1]=>
array(3) {
["abbv"]=>
string(10) "Double bed"
["desc"]=>
string(0) ""
["image"]=>
string(10) "double.png"
}
[3]=>
array(3) {
["abbv"]=>
string(6) "Single"
["desc"]=>
string(0) ""
["image"]=>
string(10) "single.png"
}
}
["rooms_by_type"]=>
array(2) {
[1]=>
array(2) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
}
[3]=>
array(10) {
[0]=>
string(1) "5"
[1]=>
string(1) "6"
[2]=>
string(1) "7"
[3]=>
string(1) "8"
[4]=>
string(1) "9"
[5]=>
string(2) "10"
[6]=>
string(2) "11"
[7]=>
string(2) "12"
[8]=>
string(2) "13"
[9]=>
string(2) "14"
}
}
["rooms_max_people"]=>
array(2) {
[1]=>
array(2) {
[1]=>
string(1) "2"
[2]=>
string(1) "2"
}
[3]=>
array(10) {
[5]=>
string(1) "2"
[6]=>
string(1) "2"
[7]=>
string(1) "2"
[8]=>
string(1) "2"
[9]=>
string(1) "2"
[10]=>
string(1) "2"
[11]=>
string(1) "2"
[12]=>
string(1) "2"
[13]=>
string(1) "2"
[14]=>
string(1) "2"
}
}
["rooms_max_adults"]=>
array(2) {
[1]=>
array(2) {
[1]=>
string(1) "2"
[2]=>
string(1) "2"
}
[3]=>
array(10) {
[5]=>
string(1) "2"
[6]=>
string(1) "2"
[7]=>
string(1) "2"
[8]=>
string(1) "2"
[9]=>
string(1) "2"
[10]=>
string(1) "2"
[11]=>
string(1) "2"
[12]=>
string(1) "2"
[13]=>
string(1) "2"
[14]=>
string(1) "2"
}
}
["rooms_max_children"]=>
array(2) {
[1]=>
array(2) {
[1]=>
string(1) "0"
[2]=>
string(1) "0"
}
[3]=>
array(10) {
[5]=>
string(1) "0"
[6]=>
string(1) "0"
[7]=>
string(1) "0"
[8]=>
string(1) "0"
[9]=>
string(1) "0"
[10]=>
string(1) "0"
[11]=>
string(1) "0"
[12]=>
string(1) "0"
[13]=>
string(1) "0"
[14]=>
string(1) "0"
}
}
["accommodation_tax_rate"]=>
float(20)
["RANDOM_IDENTIFIER"]=>
string(10) "jlLGllrPPF"
["AVERAGE_RATING"]=>
string(3) "8.3"
["NUMBER_OF_REVIEWS"]=>
string(1) "3"
["_JOMRES_REVIEWS"]=>
string(7) "Reviews"
["_JOMRES_REVIEWS_AVERAGE_RATING"]=>
string(8) "Rating: "
["_JOMRES_REVIEWS_TOTAL_VOTES"]=>
string(12) "Total Votes:"
["COLON"]=>
string(3) " : "
["HYPHEN"]=>
string(3) " - "
["RATING_TEXT_COLOUR"]=>
string(10) "text-muted"
["REVIEWS_SECTION"]=>
string(325) "
<div class="row d - none d - md - block">
<div class="col - 5">
<span class="badge bg - success">Fantastic</span>
</div>
<div class="col - 7">
<div class="row">
<span class="text - success">Rating: 8.3</span>
</div>
<div class="row">
<span class="text - muted small">Number of reviews 3</span>
</div>
</div>
</div>
"
["REVIEWS_BUTTON"]=>
string(187) "
<button class="btn btn - primary btn - sm" type="button" data-bs-toggle="offcanvas" data-bs-target="#reviewsOffCanvasjlLGllrPPF" aria-controls="offcanvasReviews">
Show reviews
</button >
"
["RIBBON"]=>
string(106) " < div class='ribbon 000000' ><span class='' style = 'background:#90EC33;color:#000000;' > Fantastic</span ></div > "
["UID"]=>
int(1)
["THUMBNAIL"]=>
string(67) " / Joomla_4 / jomres / uploadedimages / 1 / property / 0 / thumbnail / ihallway . jpg"
["IMAGELARGE"]=>
string(57) " / Joomla_4 / jomres / uploadedimages / 1 / property / 0 / ihallway . jpg"
["IMAGEMEDIUM"]=>
string(64) " / Joomla_4 / jomres / uploadedimages / 1 / property / 0 / medium / ihallway . jpg"
["IMAGETHUMB"]=>
string(67) " / Joomla_4 / jomres / uploadedimages / 1 / property / 0 / thumbnail / ihallway . jpg"
["PROPERTY_DESCRIPTION"]=>
string(445) "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua . Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat . Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur . Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum . "
["PRICE_PRE_TEXT"]=>
string(12) "Prices from "
["PRICE_PRICE"]=>
string(9) "110.00€"
["PRICE_POST_TEXT"]=>
string(15) " & nbsp;Per night"
["PROPERTY_UID"]=>
int(1)
["LIVE_SITE"]=>
string(25) "http://localhost/Joomla_4"
["MOREINFORMATION"]=>
string(9) "Read more"
["QUICKINFORMATION"]=>
string(10) "Quick Info"
["MOREINFORMATIONLINK"]=>
string(32) "/Joomla_4/en/hotel-olivia-1/view"
["STARSIMAGES"]=>
string(225) "<img src="/manual/ / Joomla_4 / jomres / assets / images / star . png" alt="star" border="0" /><img src="/manual/ / Joomla_4 / jomres / assets / images / star . png" alt="star" border="0" /><img src="/manual/ / Joomla_4 / jomres / assets / images / star . png" alt="star" border="0" />"
["SUPERIOR"]=>
string(83) "<img src="/manual/ / Joomla_4 / jomres / assets / images / superior . png" alt="superior" border="0" />"
}