简体   繁体   中英

how Add multiple article id in Joomla header section

Joomla- how Add multiple article id

code here

<?php if (JRequest::getVar('view')=='article' && JRequest::getVar('id')==2) { ?>
<script type="text/javascript">

</script>
<?php } ?>

You can do this by modifying your if statement to use PHP's in_array() function and passing it an array of article IDs:

<?php if (JRequest::getVar('view')=='article' && 
          in_array(JRequest::getVar('id'), array(2,3,4,5))) { ?>
<script type="text/javascript">

</script>
<?php } ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM