<?xml version="1.0"?>
<rss version="2.0"><channel><title>Custom Field PHP Based Formatting Latest Topics</title><link>https://forum.jreviews.com/forum/125-custom-field-php-based-formatting/</link><description>Custom Field PHP Based Formatting Latest Topics</description><language>en</language><item><title>Calculate Age</title><link>https://forum.jreviews.com/topic/31913-calculate-age/</link><description><![CDATA[<p>
	Hello Alejandro:
</p>

<p>
	I'm trying to implement some PHP code you shared to calculate someone's age from their date of birth.  Below is the code;
</p>

<p>
	<strong>$bday = new DateTime($text); $today = new DateTime(); $diff = $today-&gt;diff($bday); return $diff-&gt;y;</strong>
</p>

<p>
	I have a field for the date of birth {jr_dateofbirth}.  Do I need to create a banner field like {jr_age} to display the results?<br />
	<br />
	How do I format the code to make it work for the fields I am using?
</p>

<p>
	I hope I made sense in what I'm trying to acheive.<br />
	<br />
	Thanks<br />
	<br />
	Law
</p>
]]></description><guid isPermaLink="false">31913</guid><pubDate>Thu, 24 Jun 2021 17:11:33 +0000</pubDate></item><item><title>Trying to echo text IF listing text is empty</title><link>https://forum.jreviews.com/topic/31797-trying-to-echo-text-if-listing-text-is-empty/</link><description><![CDATA[<p>
	This code should work on listing detail, right?
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pun">&lt;?</span><span class="pln">php </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">empty</span><span class="pun">(</span><span class="pln">$listing</span><span class="pun">[</span><span class="str">'Listing'</span><span class="pun">][</span><span class="str">'text'</span><span class="pun">]):</span><span class="pln"> echo </span><span class="str">"No summary has been added just yet"</span><span class="pun">;</span><span class="pln"> </span><span class="kwd">else</span><span class="pun">:</span><span class="pln"> </span><span class="pun">?&gt;</span><span class="pln">
 // Continue</span></pre>

<p>
	Except it doesn't. What am I doing wrong? 
</p>
]]></description><guid isPermaLink="false">31797</guid><pubDate>Wed, 17 Feb 2021 21:39:14 +0000</pubDate></item><item><title>Make php based field searchable</title><link>https://forum.jreviews.com/topic/31282-make-php-based-field-searchable/</link><description><![CDATA[
<p>
	Hi Alejandro,
</p>

<p>
	maybe you know, that I am using Amazon Product Advertising API in Banner fields to show price, title and other product details regarding to the ASIN number of a book (different field). This works great.
</p>

<p>
	Code which I am using to get the author of a book (In Banner field / PHP Based Formatting):
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">require_once PATH_ROOT."amazon.php";
$asin = $CustomFields-&gt;fieldValue('jr_amazonasinoderisbn10',$entry);
// Region code and Product ASIN
$response = getAmazonPrice("de", $asin);

if ($response) {
 
return  $response['author'];

}


return false;</span></pre>

<p>
	 
</p>

<p>
	I was thinking about, if it would be possible to make these banner  fields searchable like a text field? In this way we don't have to fill out every detail about a book for a book review.
</p>

<p>
	 
</p>

<p>
	Example:
</p>

<p>
	For my listings "Book reviews" I have to fill out: ASIN Number, author, title of the book, and so on..
</p>

<p>
	But with the ASIN Number and the Product Advertising API I could get all the other details automatically. So the fields author, title, price could be filled out automatically.
</p>

<p>
	Is this possible?
</p>

<p>
	Best regards,
</p>

<p>
	Daniel
</p>
]]></description><guid isPermaLink="false">31282</guid><pubDate>Tue, 22 Oct 2019 21:32:55 +0000</pubDate></item><item><title>custom where using custom fields</title><link>https://forum.jreviews.com/topic/31179-custom-where-using-custom-fields/</link><description><![CDATA[
<p>
	hi all, 
</p>

<p>
	 
</p>

<p>
	just a quick one, i am getting a syntax error on the following where.. (its a guess).
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	I have a custom field that lists all accessibility tags of a list and all i want to do is create a button of 'similar listings' based on geolocation to current listing and also to its already selected accessibility tags.
</p>

<p>
	 
</p>

<p>
	Ideally the tags would come from the user selected tags rather than the listed tags (user may select 1 tag however list may have 5 so i would prefer to use the 1 tag).
</p>

<p>
	 
</p>

<p>
	Am i right in thinking the where is simply  Field.jr_accessibility = {user_jr_accessibility}    
</p>

<p>
	 
</p>

<p>
	Error message is ----- but works when i remove the WHERE clause
</p>

<p>
	1064
</p>

<p>
	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '} ) ) ORDER BY Totals.user_rating DESC, Totals.listing_id DESC LIMIT 10' at line 79
</p>

<p>
	The page you are looking for does not exist or an other error occurred.
</p>
]]></description><guid isPermaLink="false">31179</guid><pubDate>Sat, 10 Aug 2019 18:28:02 +0000</pubDate></item><item><title>Changing tag URLs for custom lists.</title><link>https://forum.jreviews.com/topic/31034-changing-tag-urls-for-custom-lists/</link><description><![CDATA[
<p>
	Hi,
</p>

<p>
	<strong>Intro</strong>: I have custom lists for many tag urls, e.g. /year/2019 for Click2Search's /alias/tag/year/2019. 
</p>

<p>
	<strong>Task</strong>: change displayed Click2Search urls for shorter custom list ones.
</p>

<p>
	<strong>Done</strong>: for single select fileds (PHP Based Formatting):
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">$url .='</span><span class="tag">&lt;a</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">"/year/'.$value.'"</span><span class="tag">&gt;</span><span class="pln">'.$value.'</span><span class="tag">&lt;/a&gt;</span><span class="pln">';
return $url;</span></pre>

<p>
	<strong>Problem</strong>: multiple select fields. The code above is not working because of an array instead of a string.
</p>

<p>
	<strong>Help</strong>: Can you please hint me how to modify an array output for Click2Search urls the same way as with a string output?
</p>
]]></description><guid isPermaLink="false">31034</guid><pubDate>Thu, 04 Apr 2019 09:56:58 +0000</pubDate></item><item><title>How to add currency format</title><link>https://forum.jreviews.com/topic/30807-how-to-add-currency-format/</link><description><![CDATA[
<p>
	Just playing with the banner field and php bases formating and have a little question.
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">$price = $CustomFields-&gt;fieldValue('jr_price',$entry);
$volume = $CustomFields-&gt;fieldValue('jr_volume',$entry);
$total = $price * $volume;
return $total;</span></pre>

<p>
	How can I put in the currency format like this:
</p>

<p>
	1200,- €
</p>

<p>
	instead of
</p>

<p>
	1200
</p>

<p>
	And additional:<br /><br />
	How can I devide? In this way?
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">$total = $price / $volume;</span></pre>

<p>
	 
</p>
]]></description><guid isPermaLink="false">30807</guid><pubDate>Sun, 25 Nov 2018 12:52:25 +0000</pubDate></item><item><title>Color change</title><link>https://forum.jreviews.com/topic/30265-color-change/</link><description><![CDATA[<p>Hi. Cannot find how to change single select output text color depending on selection. Any clue?</p>]]></description><guid isPermaLink="false">30265</guid><pubDate>Thu, 15 Mar 2018 16:07:25 +0000</pubDate></item><item><title>Custom field type change</title><link>https://forum.jreviews.com/topic/30259-custom-field-type-change/</link><description><![CDATA[<p>Still cannot get how to change custom fired type from text to long text. I don't want to delete existing ones since need to keep entered information. Thanx in advance.</p>]]></description><guid isPermaLink="false">30259</guid><pubDate>Tue, 13 Mar 2018 12:52:49 +0000</pubDate></item><item><title>Documentation</title><link>https://forum.jreviews.com/topic/30248-documentation/</link><description><![CDATA[<p>
	Please refer to the <a href="https://www.jreviews.com/docs/developers/custom-field-php-formatting" rel="external">PHP Based Formatting </a>documentation before posting here. The documentation has not been updated yet for JReviews 3, so feel free to post about necessary code changes as we work on updating that article.
</p>]]></description><guid isPermaLink="false">30248</guid><pubDate>Thu, 08 Mar 2018 13:28:33 +0000</pubDate></item></channel></rss>
