Using conditional statements in .ctp file

Hi I have a requirement of using conditional statements in my .ctp file which has only html and some javascript code. Please find below the code of .ctp file. This .ctp file receives the data from .js file. The .js file uses the find method to find class name under which data need to be displayed. Like in the below code to display data under class model-content I have used

    tag. So in .js file my code would be “viewTarget.find(’.model-content’).find(‘ul’).html(arrayname.join(”"));". Now similarly I can send data from .js file to .ctp file.

    Now the requirement is I want to display the button in the below code based on some condition am getting from .js file. I need to display button only in some cases and I should display the link in some cases. And in some cases I need to skip both button and link in the below code. So to achieve this kindly help me with method to use conditional statements in my .ctp file.

    Full Factory Divest
    		<span id=sourcingexit onclick="focusOnElement();">Sourcing Group Exit</span>
    
    		<div id="myModal" class="modal">
    
    			  <div class="modal-content">
    
    				<ul></ul>
    			  </div>
    
    		</div>
    	</div>
    1 Like