Avatar of charmingduck
charmingduck

asked on 

drupal coding

Please see attached, why is there a colon  at the end of the if statement? what does it do?

<?php if (!$page): ?>
<?php if (!$page): ?>
  <h2><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
<?php endif; ?>

<?php if ($submitted): ?>
  <span class="submitted"><?php print $submitted; ?></span>
<?php endif; ?>

Open in new window

PHP

Avatar of undefined
Last Comment
charmingduck
Avatar of dsmile
dsmile
Flag of Viet Nam image

It's the syntax of drupal template

<?php if($test == 1): ?>
do something
<?php else: ?>
do something else
<?php endif; ?>

<?php foreach($items as $item): ?>
<?php echo $item->getTitle(); ?>
<?php endforeach; ?>
Avatar of dsmile
dsmile
Flag of Viet Nam image

You can consider it as "start of condition/block statement"
Avatar of charmingduck
charmingduck

ASKER

thanks, can I find more details about the ':' on the drupal website?
ASKER CERTIFIED SOLUTION
Avatar of dsmile
dsmile
Flag of Viet Nam image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of charmingduck
charmingduck

ASKER

thanks so much
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo