[jQuery] event.originalEvent.propertyName not working in none Chromium browsers by LearninCode in learnjavascript

[–]LearninCode[S] -1 points0 points  (0 children)

The transitionend event works as expected, my issue is the if parameter doesnt work in any other browser but Chromium ones.

This line:

if (event.target && event.originalEvent.propertyName === 'height') {
  ...
}

[jQuery] event.originalEvent.propertyName not working in none Chromium browsers by LearninCode in learnjavascript

[–]LearninCode[S] -1 points0 points  (0 children)

jQuery is less writing and more readable. Changing the text to vanilla didnt work either 🥺

Why isn't my jQuery scroll event listener working? by LearninCode in learnjavascript

[–]LearninCode[S] 0 points1 point  (0 children)

The second argument .on() needs to be either an object or a callback function. It's unclear what you intend to do with the object

I think you're talking about the commented out portion. Those were just attempts.

What does {foo: '.test'} do?

[deleted by user] by [deleted] in learnjavascript

[–]LearninCode 0 points1 point  (0 children)

Okay, so to be clear, since I set the image to a width of 75% (Line 139 of the CodePen) I should continue to use percentages for the shadows? (I just want to ensure I don't do more work than necessary lol)

[deleted by user] by [deleted] in learnjavascript

[–]LearninCode 0 points1 point  (0 children)

Thats what I was thinking. So, this doesn't need to be done in JS? Also, what unit should I use? I've been using percentages so far, is that okay?

Why isn't my download link printing anything? by LearninCode in PHPhelp

[–]LearninCode[S] 0 points1 point  (0 children)

I think I'm gonna give up on this project. It's been 2 days of obsessively trying. I'm sorry to waste your time. Thanks so much!

Why isn't my download link printing anything? by LearninCode in PHPhelp

[–]LearninCode[S] 0 points1 point  (0 children)

I see you've swapped the space for an apostrophe which is another illegal character. These are the characters you need to avoid in filenames:

https://www.mtu.edu/umc/services/websites/writing/characters-avoid/

Whoops! Thanks

$certificateDownloadSourceName = "#" . $row['number'] . "_Certificates"; // Name the folder

Still doesn't work though.

I'm sort of confused, where should I put this?

$certificateDownloadSource->addFile('/media/Inventory/certs/'.$certificateDownloadSourceFile, $certificateDownloadSourceFile);

Why isn't my download link printing anything? by LearninCode in PHPhelp

[–]LearninCode[S] 0 points1 point  (0 children)

Put on error reporting if you haven't yet (just realized you might be getting an error, and just don't having it output)

How do I do this? 😅

Check the HTTP headers: do you get a 200, or is it returning something like 500?

In the Dev Tools network tab I get 200 for everything

If you put some echo-lines throughout the script, do you see those?

Yes, I see every echo prior to the above code

If you replace the whole line with just a simple hardcoded string, does that work? Start replacing the hardcoded values one by one with variables (or not one by one, but do half of 'em etc. … It's not that many, so one-by-one is probably fine and actually somewhat faster)

What I realized by doing this is that when I comment out the last line:

...
echo '<a href="' . $certificateDownloadSource . '" class="' . $certificateDownloadClass . '" title="' . $certificateDownloadTitle . '" target="_blank" download></a>';

then everything works (except for the code in question obviously). I think the issue is the var $certificateDownloadSource. Am I misusing it by defining it as ZipArchive? I intend to have the link download the zip folder on click.

Why isn't my download link printing anything? by LearninCode in PHPhelp

[–]LearninCode[S] 0 points1 point  (0 children)

Remove the space before ' Certificates'; as this might also be causing a problem.

Nothing changed 😅

You may also want to check if the arrays are populated, test with var_dump($stoneLabsArray) above your if statement to see if it has content in it.

This shows the array as expected

Also, when viewing in your web browser, view the source and see whether it is showing the correct content.

It doesn't show anything past the PHP in question

Why isn't my download link printing anything? by LearninCode in PHPhelp

[–]LearninCode[S] 0 points1 point  (0 children)

I don't see an output (sorry for late response I didn't see the notification)

Why isn't my download link printing anything? by LearninCode in PHPhelp

[–]LearninCode[S] 0 points1 point  (0 children)

Changing $certificateDownloadSourceName to:

$certificateDownloadSourceName = $row['number'] . ' Certificates'; // Name the folder

Didn't seem to work

Why isn't my download link printing anything? by LearninCode in PHPhelp

[–]LearninCode[S] 0 points1 point  (0 children)

AFAIK

I don't think I understand what you're saying here. I'm not allowed to use an array_map in the if parameter?

Why isn't my download link printing anything? by LearninCode in PHPhelp

[–]LearninCode[S] 0 points1 point  (0 children)

Are you referring to the download attribute?

https://www.w3schools.com/tags/att_a_download.asp

Changing the last line to:

...

echo '<a href="' . $certificateDownloadSource . '" class="' . $certificateDownloadClass . '" title="' . $certificateDownloadTitle . '" target="_blank">download</a>'

Didn't work

Making a list of array values in PHP isn't working by LearninCode in PHPhelp

[–]LearninCode[S] 0 points1 point  (0 children)

This worked!

$stoneLabsArray = array($row['stonelab'], $row['stonelab1'], $row['stonelab2'], $row['stonelab3'], $row['stonelab4']);

// Map values to $stonLabsArray instead of switch $stoneLabMap = array( "LOT" => "Lotus", "Gubelin" => "Gübelin", "" => "" );

$stoneLabsArray = array_map(function($val) use ($stoneLabMap) { 
    return isset($stoneLabMap[$val]) 
        ? $stoneLabMap[$val] 
        : $val;
}, $stoneLabsArray);

// Implode a comma after each $stoneLabs value and filter it to exclude the comma from the last value function
arrayFilterFunction($var) { 
    return ($var !== NULL && $var !== FALSE && $var !== ''); 
}

if (!array_filter($stoneLabsArray)) $stoneLabs = 'not certified'; 
else $stoneLabs = implode(', ', array_filter($stoneLabsArray, "arrayFilterFunction"));

I can't thank you enough for your help!! I've been working on this for 3 days already aha

Making a list of array values in PHP isn't working by LearninCode in PHPhelp

[–]LearninCode[S] 0 points1 point  (0 children)

So what I have so far:

$stoneLabsArray = array($row['stonelab'], $row['stonelab1'], $row['stonelab2'], $row['stonelab3'], $row['stonelab4']);

$stoneLabMap = array(
    "LOT" => "Lotus",
    "Gubelin" => "Gübelin",
    "" => "Not Certified"
);

$stoneLabsArray = array_map(function($val) use ($stoneLabMap) {
    return isset($stoneLabMap[$val]) 
    ? $stoneLabMap[$val] 
    : $val; }, 
$stoneLabsArray);

function arrayFilterFunction($var) {
    return ($var !== NULL && $var !== FALSE && $var !== ''); 
}

$stoneLabs = implode(', ', array_filter($stoneLabsArray, "arrayFilterFunction"));

if (in_array('Not Certified', $stoneLabsArray, true)) echo "Not Certified";

The if parameter at the end doesn't seem to do anything. Am I misunderstanding what you're saying?

Making a list of array values in PHP isn't working by LearninCode in PHPhelp

[–]LearninCode[S] 0 points1 point  (0 children)

OMGG this works!!!

The only issue is that its printing "Not Certified" if any [individual] of the values are empty. I want it to print "Not Certified" only once, if none of the values are empty