I have a class called CouponGenerator
. This class has two functions:
public function generateCoupon() {
// CODE HERE
}
and
public function loadCoupon() {
require_once(dirname(__FILE__).'/templates/couponDiv.php');
}
Inside the couponDiv.php
file I have some markup:
<?php
$coupon = new CouponGenerator();
?>
<div class="fbsc_container" id="outer_div">
<div class="fbsc_container" id="fbsc_content">
<h4 class="fbsc_text" id="fbsc_header"> [HEADER] </h4>
<p class="fbsc_text" id="fbsc_inside_text"> <?php $coupon->generateCoupon(); ?> </p>
</div>
</div>
Sadly $coupon->generateCoupon();
does not activate the generateCoupon()
function for me at all. I am not sure if I am calling it correctly from inside of the couponDiv.php
file.
How could I make it work correctly?
I solved it, forgot to put 'echo' before calling the function.
Case closed.