Hi All, I'm a PHP Beginner and am having a hard time customizing a WP Plugin that is using the period sign "." to call a variable. Basically, it is setting the CSS Background to $url but I need to append a string to the beginning so it will work with TimThumb. Here's the code in the plugin: $output .= '<div style="border: 0pt none ; margin: 0pt; padding: 0pt; background: transparent url(' . $url . ') no-repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; width: 100px; height: 100px;"></div>'; Code (markup): I want to add "<?php echo get_bloginfo('template_url');?>/timthumb.php?src=" in front of it and "&h=100&w=100&s=1" behind it. I tried this, but it gave me Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in error: $output .= '<div style="border: 0pt none ; margin: 0pt; padding: 0pt; background: transparent url(''<?php echo get_bloginfo('template_url');?>/timthumb.php?src=' . $url . '&h=100&w=100&s=1' ') no-repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; width: 100px; height: 100px;"></div>'; Code (markup): Any help is GREATLY appreciated, thanks all!
try this: $output .= '<div style="border: 0pt none;margin: 0pt;padding: 0pt;background: transparent url("get_bloginfo(\'template_url\') . "/timthumb.php?src=" . $url . "&h=100&w=100&s=1";") no-repeat scroll 0% 0%;-moz-background-clip: border;-moz-background-origin: padding;-moz-background-inline-policy: continuous;width: 100px;height: 100px;"></div>'; Code (markup):
Thanks for the reply! Unfortunately, that doesn't work. We don't need to use the get_bloginfo. Instead, we can use the hardcoded full URL, say http://www.thisdomain.com/wp-content/themes/themeone/ I've figured it out assigning the before and after as variables $before and $after and then going . $before . $url . $after . But, I'd still love to know how to do it without that, especially when using another php variable.
I think this is what you are looking for: $output .= '<div style="border: 0pt none ; margin: 0pt; padding: 0pt; background: transparent url(http://www.thisdomain.com/wp-content/themes/themeone/timthumb.php?src='.$url.'&h=100&w=100&s=1) no-repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; width: 100px; height: 100px;"></div>'; PHP:
yep sure it didnt, cuz i actually messed something, anyway "jestep" post i think should work also try this one: $output .= "<div style='border: 0pt none;margin: 0pt;padding: 0pt;background: transparent url(http://www.thisdomain.com/wp-content/themes/themeone/timthumb.php?src=" . $url . "&h=100&w=100&s=1)no-repeat scroll 0% 0%;-moz-background-clip: border;-moz-background-origin: padding;-moz-background-inline-policy: continuous;width: 100px;height: 100px;'></div>"; Code (markup):