Functions:pageSearchGet
Description
Retrieves page and product data on pages that qualify for a keyword search.
Syntax
$arrPages= eV::pageSearchGet($keywords[,$fieldList=NULL][,$orderBy=NULL][,$orderDir="DESC"][,$orderType="str"]);
Paramaters
- $keywords STRING
- Keywords to be used to qualify the page search
- $fieldList STRING (optional)
- comma delimited list of field names you would like returned. leaving this value empty will return all fields, though this is not recommended as it could significantly reduce system performance. Page custom fields can be requested by prepending the custom field name with "custom_field_" (example: to include the "myVar" custom field, add "custom_field_myVar" to the $fieldList).
- $orderBy STRING (optional)
- field to order by. This field must be present in the $fieldList. defaults to 'orderId' which corresponds to the order the children are listed in relationships management for the parent $pageId
- $orderDir STRING (optional)
- Either "ASC" or "DESC" signifying the direction of the sorted results. Defaults to "DESC".
- $orderType STRING (optional)
- Either "str" or "num" signifying how the values will be compared when sorting the results. Defaults to "str"
Return Values
Returns a multidimensional array of page data that qualifies for the search. The first dimension is a numerically indexed array of each child (starting from 0). The second dimension is an associative array of keys corresponding to the fields requested in the $fieldList attribute (if $fieldList is empty, all fields are returned. This is not recommended as it creates unnecessary overhead).
The returned array is as follows (all possible fields are listed, note that only fields requested will be returned):
Array ( [0] => Array ( // fields automatically included [relevance] => FLOAT [pageId] => INT [blog_userId] => INT // user id for blogger [authorId] => INT // user id for author [isLinkDirect] => BIT // signal that this is an outside link circumvents page forwarding [isForum] => BIT [link] => STR //page data [templateId] => INT [notice] => STR [title] => STR [subTitle] => STR [copy] => STR [summary] => STR [summaryImage] => STR [summaryImageAlt] => STR [summaryImageCaption] => STR [linkText] => STR [publisher] => STR [publishDate] => DATETIME [startDate] => DATETIME [endDate] => DATETIME [isBlog] => BIT [isPoll] => BIT [createDate] => DATETIME [modDate] => DATETIME // author fields [author_firstName] => STRING [author_lastName] => STRING [author_userImage] => STRING [author_handle] => STRING // blogger fields [blog_firstName] => STRING [blog_lastName] => STRING [blog_userImage] => STRING [blog_handle] => STRING // forum / comments fields [forumCount] => INT [ratingTotal] => INT [ratingCount] => INT [ratingAverage] => DECIMAL // product fields [productName] => STRING (for first product in page) [productTitle] => STRING (for first product in page) [productDescription] => STRING (for first product in page) [productId] => INT (for first product in page) [lowestPrice] => DECIMAL [lowestListPrice] => DECIMAL [lowestSalePrice] => DECIMAL [productCount] => INT [productIdList] => STRING (comma delimited list of INT) [saleFromDate] => DATETIME (for first product in page) [saleToDate] => DATETIME (for first product in page) [lowestLevelPrice] => DECIMAL [lowestAllPrice] => DECIMAL //children's children and children's grandchildren (great grandchildren to parent pageId) [childPageCount] => INT [grandChildPageCount] => INT //poll data [pollCount] => INT //custom fields [custom_field_?] => ? ) [1] => Array ... )
Elements from the page associative array are as follows:
Element | Description | Example |
fields automatically included | ||
relevance | FLOAT - a numerical representation of how relevant the page is to the keywords entered. Higher number = more relevant. | 1.12 |
pageId | INT - system assigned unique pageId of the returned page | 6 |
blog_userId | INT - system assigned unique userId of the blogger designed in page management to this page. If the page is not a blog, value will be empty. | 10 |
authorId | INT - system assigned unique userId of the author designated in page management to this page. If no author is assigned, this value will be empty | 14 |
isLinkDirect | BIT - either 1 or 0 designating if the link is direct. If it is a direct link, the value of the 'link' field will be the ultimate target of the link, regardless if it is internal or external. If the link is not direct, the value of the 'link' field will always be internal - external links will be redirected from the internal page. The latter is for tracking purposes. | 0 |
isForum | BIT - either 1 or 0 designating if the page is selected in page management to be a forum. Note this option will only be available if Forums Available is set on in Settings. Use this flag to hide/show forum related page content and logic, so this data is not displayed / processed if the page manager has forums turned off for the page. | 1 |
link | STRING - the link to this page. This should be placed in the HREF attribute of the A link tag. The system will automatically generate the correct link to the internal / external target and take into consideration if the link is direct (isLinkDirect) or not. | index.php?pageId=192 |
page data | ||
templateId | INT - system assigned unique template id for the template selected in page management for this page | 12 |
notice | STRING - notice field entry for this page in page management. Note that notice has to be turned on in Settings to be available in page management. Also notice can be renamed in Settings, therefore might not be titled 'notice' in page management. Often notice is used as the Page Name (unique description of the page for internal use / page identification) | This is my page |
title | STRING - title field entry for this page in page management. Note that title can be renamed in Settings, therefore might not be titled 'title' in page management. This is used as the text descriptor of the page in all areas of administration that list pages (page children, parents, page search, etc). Other fields may be designated to appear as descriptors in administration by changing the Summary Listing Details under the Page Management tab. | The page title |
subTitle | STRING - subtitle field entry for this page in page management. Note that subtitle has to be turned on in Settings to be available in page management. Also subtitle can be renamed in Settings, therefore might not be titled 'subtitle' in page management. | This is the subtitle for this page |
copy | STRING - HTML formatted page copy, as set in the copy field WYSIWYG editor in page management. This serves as the bulk of the page's content. Copy is typically not displayed in page searches / page children as it is to much information when listing multiple page results, though sometimes it is truncates in the results. Note that copy is HTML content, as it is managed by the WYSIWYG editor. | <img src="image.jpg" align="right"><p>This is the <b>copy>/b> for this <i>page</i> |
summary | ||
summaryImage | ||
summaryImageAlt | ||
summaryImageCaption | ||
linkText | ||
publisher | ||
publishDate | ||
startDate] | ||
endDate | ||
isBlog | ||
isPoll | ||
createDate | ||
modDate | ||
author fields | ||
author_firstName | ||
author_lastName | ||
author_userImage | ||
author_handle | ||
blogger fields | ||
blog_firstName | ||
blog_lastName | ||
blog_userImage | ||
blog_handle | ||
forum / comments fields | ||
forumCount | ||
ratingTotal | ||
ratingCount | ||
ratingAverage | ||
product fields | ||
productName | ||
productTitle | ||
productDescription | ||
productId | ||
lowestPrice | ||
lowestListPrice | ||
lowestSalePrice | ||
productCount | ||
productIdList | ||
saleFromDate | ||
saleToDate | ||
lowestLevelPrice | ||
lowestAllPrice | ||
children's children and children's grandchildren (great grandchildren to parent pageId) | ||
childPageCount | ||
grandChildPageCount | ||
poll data | ||
pollCount | ||
custom fields | ||
custom_field_? |
Examples
- Example
// call $searchArr = eV::pageSearchGet('several keywords here','title,summary,summaryImage,link','relevance','DESC','num'); // output foreach($searchArr as $search) { echo "<hr>"; echo "<a href=\"" . $search['link'] . "\">"; echo "<img align=\"left\" src=\"" . $search['summaryImage'] . "\">"; echo "</a>"; echo "<a href=\"" . $search['link'] . "\">" . $search['title'] . "</a>"; echo "<br>" . $search['summary']; echo "<br><i>Relevance:" . $search['relevance'] . "</i>"; };