Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Adam, thank you very much for that response.

    Thank you for that information.

    I’m having the same problem with both Amazon links and YouTube links.

    Thread Starter carymillsap

    (@carymillsap)

    That was exactly the problem. Thank you very much!

    Cary

    Thread Starter carymillsap

    (@carymillsap)

    Thank you, Shea. Problem solved.

    Thread Starter carymillsap

    (@carymillsap)

    It’s pretty darned impressive, actually, the documentation you’ve provided with the product. I ’bout lost my liver when my site broke, but your instructions on what to do what that happens were crystal clear and effective. By using include_once instead of include, now I’m good.

    I’m still interested in your response to my problem with global, though. Will eagerly await what you have to say about that.

    Thanks again for the help!

    Thread Starter carymillsap

    (@carymillsap)

    I got my site back up, by renaming wp-content/plugins/code-snippets to …/code-snippets-xxx, and I’ve found the Safe Mode instructions in the readme.txt file now, so I’m pretty sure I’m going to live :-).

    Thread Starter carymillsap

    (@carymillsap)

    My whole site is down now. I tried to define a second snippet, which includes the same “functions.php” that we’ve been talking about. Now every page on my site (even my admin pages) renders:

    Fatal error: Cannot redeclare distribution_filename() (previously declared in /home/methodr8/public_html/cgi-bin/functions.php:10) in /home/methodr8/public_html/cgi-bin/functions.php on line 15

    I know I need to change include to include_once, but now I cannot even open my Dashboard. I’m going to need help (please!) fixing this from an SSH command line.

    Thread Starter carymillsap

    (@carymillsap)

    Shea, I sure appreciate the help. Your response helps me put my finger on the core problem, which I can demonstrate without even mentioning include:

    $x = 42;
    add_shortcode("s", "f");
    function f($atts) {
      global $x;
      return "x is '$x'";
    }

    Using the shortcode [s] produces the text x is ''.

    Furthermore, if I include a file that has something like this in it:

    $constant=42;
    function g() {
      global $constant;
      return $constant;
    }

    …then g() returns an empty result as well, to the snippet. When I’m including the same file from https://mysite.com/something.php that calls g(), in that context, it returns 42. But it returns empty when called from a Snippet.

    • This reply was modified 7 years, 9 months ago by carymillsap.
    • This reply was modified 7 years, 9 months ago by carymillsap.
    Thread Starter carymillsap

    (@carymillsap)

    Thank you, Shea.

    …I didn’t think I needed to tell you the whole story, but now I do. I’ve got functions, too, that I need to include. When I wrote my original ticket to you, I had constants and functions both in constants.php. (For some reason that I don’t understand, the functions make it into the symbol table, but the variables don’t. This is why I didn’t mention the functions before.) But the functions use the constants.

    I can’t include a file within my snippet function that contains function definitions, because I get a “Fatal error: Cannot redeclare function_name()”. I’ve separated the functions from the constants, so now I have both constants.php and functions.php. When I include functions.php outside of the snippet function, the functions can’t see the constants (even though functions.php does include “/full/path/constants.php”). When I include functions.php within the snippet function, I get the fatal error.

    Am I even going down a road where success is possible here?

    Thank you again for your help.

    • This reply was modified 7 years, 9 months ago by carymillsap.
Viewing 10 replies - 1 through 10 (of 10 total)