Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


cyberRobot last won the day on November 1 2018

cyberRobot had the most liked content!

Community Reputation

113 Excellent

About cyberRobot

  • Rank
    Much to Learn

Contact Methods

  • Website URL

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

84,351 profile views
  1. cyberRobot

    float left div

    By default, browsers apply margins (or padding) to the <ul> tag. The white space can be removed by adjusting the top and bottom margin / padding in your style sheet.
  2. That depends on the error / setup. If all the processing is done up front, before anything is displayed, the page could be blank when there's a fatal error.
  3. cyberRobot

    Echo Background Image Breaking site

    In case you're interested, there's a tag for opening PHP and echoing at the same time. <article class="mec-event-cover-modern <?=$this->get_event_classes($event)?>" style="background: url('<?=$event_thumb_url?>'); height: 678px;background-size: cover;"> I don't remember what the tag is called.
  4. cyberRobot

    Echo Background Image Breaking site

    I just noticed that the call to url() should go with your CSS. So it should be enclosed in your single quotes. <?php echo '<article data-style="'.$label_style.'" style="background-image:url(' . $event->data->thumbnails['medium']. ');" class="mec-event-article mec-clear '.$this->get_event_classes($event).'"' . $colorful_bg_color . '>'; ?> Once it's enclosed, the semi-colon is fine. Of course, the point is probably moot if you're using ginerjm's code. 😁
  5. cyberRobot

    Echo Background Image Breaking site

    FYI - the following line of code has an extra semi-colon in the middle, after the call to url(): <?php echo '<article data-style="'.$label_style.'" style="background-image:' .url($event->data->thumbnails['medium']);. '" class="mec-event-article mec-clear '.$this->get_event_classes($event).'"' . $colorful_bg_color . '>'; ?> With that said, I think ginerjm's suggestion for creating variables like $url will make the code easier to read down the road, when you're less familiar with the code.
  6. @mahenda - Is PHP set to display errors? You can add the following to the top of your script so that errors are displayed: <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> Note that the above should only be present when you're developing the script or debugging. The errors generated by PHP shouldn't be displayed to your visitors. They're not very user friendly and they can potentially reveal information to someone trying to compromise your website.
  7. @mahenda - Are you still working on correcting the query, as ginerjm suggested? If so, the issue with the query is that you removed the double quotes before and after the $escapeString variables, but you didn't remove the concatenation characters. For what it's worth, the query you had before ginerjm's advice should be fine. $sql = "SELECT name, producer FROM movies WHERE name LIKE '%".$escapeString."%' OR producer LIKE '%".$escapeString."%' "; Or you could use ginerjm's suggestion. $sql = "SELECT name, producer FROM movies WHERE name LIKE '%$escapeString%' OR producer LIKE '%$escapeString%'"; They're both the same query. Ginerjm's suggestion just has the PHP variables embedded in a string. Your's uses string concatenation. With that said, I would recommend renaming $escapeString to something more meaningful. At some point in time, you'll likely need to write a script where you are escaping more than one piece of information. I personally use camel case because that's how I was taught. Granted my initial learning experience wasn't with PHP. I just prefer camel case because it's easier to read (for me) then using all lower cases. I've tried switching to other recommended formats (e.g. using underscores or hyphens between words $escape_string), but I always find myself switching back to camel case. In the end, consistency is key. Using all lower-case letters, in and of itself, isn't going to save you from the headaches of mistyping a variable name. I've had many frustrations with plural vs. singular words (e.g. $name and $names). I've also had problems with words in different tenses (e.g. $escapeString and $escapedString). If you're worried about mistyping a variable, try working with a code editor that auto-completes variable names as you're typing. Mistyping should also be something you're looking at when debugging a script.
  8. Based on the code in your original post, I assume that adding "active" to the class attribute for your "carousel-item" div causes the four items to be displayed. Then the other "carousel-item" div that doesn't have the "active" class should be hidden. Assuming that's correct, you could modify the first foreach loop to get the index associated with your chunks. foreach ($fourDiv as $index => $products) { Then use that index to add the "active" class to the first "carousel-item" div tag. foreach ($fourDiv as $index => $products) { echo '<div class="carousel-item items'; if($index == 0) { echo ' active'; } echo '">';
  9. cyberRobot

    Extracting names with regex

    That's much cleaner. Thanks for the suggestion!
  10. cyberRobot

    Extracting names with regex

    I'm looking to extract names from a string that is typically formatted like the following examples: Paul Jones and Mike Smith Emily Salazar, Marcia Dunn, and John Miller Mike Smith The following code seems to be working: var inputValues = inputString.split(/, (?:and )?|(?: and )/); Does anyone have any ideas for streamlining the regex portion? I'm especially interested if there's a way to write it without the straight bar (|).
  11. When looping through the query results, you could store your 8+ rows in an array. Then use array_chunk() to split your rows in groups of four. Then use loops to output the information for your carousel.
  12. cyberRobot

    hi guys

    Welcome newbie 😊
  13. cyberRobot

    HTHL/PHP says submission worked, but no email

    It's probably better not to know. 😊 The @ symbol is for error suppression. More information can be found here: https://www.php.net/manual/en/language.operators.errorcontrol.php
  14. @aveeva - Have you done any of these steps before? If not, try starting with something small. Instead of worrying about the entire folder of images, try using PHP to figure out the dimensions of a single image using the image functions suggested by chhorn earlier. Note that you can use your browser's search feature (Ctrl + F if you're using Windows) to easily locate the function that deals with image "width". Once you're comfortable with that, you could move to the next step.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.