-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Community Answers
-
Ch0cu3r's post in help me to settle this php question was marked as the answer
I'm not going to give you the code but I will split the question into easy to follow step to achieve the set task.
Create a form with an input field for the name. Set the forms action attribute to submit.php (or to the name of your .php file) and set the forms method attribute to post then name the input field name. In the .php file your form submits to use the $_POST['name'] superglobal variable to get the name and assign it to variable, eg $name = $_POST['name']; Assign the suggest date code to a variable, name the variable hour, eg $hour = date('H'); To display the appropriate greeting depending on time of day ( $hour ). You need to use a if/elseif/else statement using the less then or greater than comparison operator(s) for comparing $hour. Example pseudo code if $hour < 12 { echo "Good morning $name" } elseif $hour >= 12 && $hour < 16 { echo "Good afternoon $name" } else { echo "Good Evening $name" } -
Ch0cu3r's post in default user avatars by gender was marked as the answer
This line here is setting the avatar to the default avatar image, if $row['avatar'] is set to the string literal default
$row['avatar'] = $row['avatar'] == "default" ? site_url. "/style/images/avatar.png":site_url.$row['avatar']; You will need to change that line to something like this
if($row['avatar'] == "default") { $row['avatar'] = site_url. "/style/images/noavatar-".$yourGenderVariableHere.".png"; } else { $row['avatar'] = site_url.$row['avatar']; } Replace $yourGenderVariableHere with your variable that contains the users gender.
-
Ch0cu3r's post in Nestable Loops was marked as the answer
Reading the documentation in the code example at the bottom is this note
Meaning when using get on the parent loop (in your case image_galleries) it will return the values of all the nested loops too. So your code will most likely need to be
<p> <?php // gets all the nested loop values too $fields = CFS()->get('image_galleries'); foreach ($fields as $field) { ?> <h2><?php echo $field['gallery_title']; ?></h2> <?php // loop over the nested loop field called 'gallery_images' foreach ($field['gallery_images'] as $gallery_image) { echo '<a href="' . $gallery_image['image_url'] . '" data-lightbox="anstie_images"><img src="' . $gallery_image['image_url'] . '" alt="' . $gallery_image_field['image_alt_text'] . '" class="thumbnails" /></a>'; } //end nested foreach loop } //end parent foreach loop ?> </p>