开发者

PHP Page-Specific Scripts and Styles Not Recognized

I have a site built with PHP includes. For scripts and styles that are used on only one page, I call them with a variable. So the header include contains this line:

<?php echo $additional; ?>

And a particular page that requires additional scripts and styles contains these lines:

<?php $additional = '<link href="/assets/style_tabbedpanels_calendar.css" rel="stylesheet" type="text/css" /><link href="/assets/style_calendar.css" rel="stylesheet" type="text/css" /><script src="/assets/script_tabbedpanels_t-l.js" type="text/javascript"></script><script src="/assets/script_calendar.js" type="text/javascript"></script><script src="/assets/script_yahoo-dom-event.js" type="text/javascript"></script>'; ?>

I didn't break each style and script onto a new line because I found that causes problems. Generally, this has worked fine, but the calendar and yahoo-dom-event scripts that I just added aren't running at all. I know this because everything works if I put them directly in the header include.

So I was wondering if I'm doing som开发者_Python百科ething wrong when defining the additional variable on the individual pages?

Thank you.


The problem seemed to be the order of the scripts. When I moved the yahoo one in front of the others, it started working.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜