carymillsap
Forum Replies Created
-
Forum: Plugins
In reply to: [Broken Link Checker] Amazon LinksAdam, thank you very much for that response.
Forum: Plugins
In reply to: [Broken Link Checker] Amazon LinksThank you for that information.
Forum: Plugins
In reply to: [Broken Link Checker] Amazon LinksI’m having the same problem with both Amazon links and YouTube links.
Forum: Plugins
In reply to: [Perfect Images] Download failed. Unauthorized.That was exactly the problem. Thank you very much!
Cary
Forum: Plugins
In reply to: [Code Snippets] Global variablesThank you, Shea. Problem solved.
Forum: Plugins
In reply to: [Code Snippets] Global variablesIt’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 ofinclude
, 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!
Forum: Plugins
In reply to: [Code Snippets] Global variablesI 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 :-).
Forum: Plugins
In reply to: [Code Snippets] Global variablesMy 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
toinclude_once
, but now I cannot even open my Dashboard. I’m going to need help (please!) fixing this from an SSH command line.Forum: Plugins
In reply to: [Code Snippets] Global variablesShea, 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 textx 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 callsg()
, 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.
Forum: Plugins
In reply to: [Code Snippets] Global variablesThank 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.