Forums / Install & configuration / How to link external Javascript files?

How to link external Javascript files?

Author Message

Gerhard Hoogterp

Tuesday 18 February 2003 3:34:56 am

While converting a site to ez3 I found a number of gotcha's for external files. Basicly css and js files.

The CSS can be handled by

<link href={"stylesheets/general.css"|ezdesign} rel="stylesheet" type="text/css" />

where the stylesheets directory is under design/slo/ (in this case) No problem there. background images in the CSS style can be found using relative paths (../images) which solves most of my problems there.

Javascript files are more problematic.

Mozilla reports:

Error: syntax error
Source File: http://ezslo.slo.nl/design/slo/javascript/screen.js
Line: 2
Source Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

The path is ok, that's where the file is. Of course it doesn't contain a DOCTYPE line so where thatone comes from is beond me.

The call is made through:

<script language="JavaScript" src={"javascript/screen.js"|ezdesign} type="text/javascript">
</script>

which works as it should outside of ez.

Who can shine some light here? Thanks.

Tony Wood

Tuesday 18 February 2003 4:42:39 am

> While converting a site to ez3 I found a number of gotcha's
> for external files. Basicly css and js files.
>
> The CSS can be handled by
>
> <link href={&#034;stylesheets/general.css&#034;|ezdesign}
> rel="stylesheet" type="text/css" />
>
> where the stylesheets directory is under design/slo/ (in
> this case) No problem there. background images in the CSS
> style can be found using relative paths (../images) which
> solves most of my problems there.
>
> Javascript files are more problematic.
>
> Mozilla reports:
>
> Error: syntax error
> Source File:
> http://ezslo.slo.nl/design/slo/javascript/screen.js
> Line: 2
> Source Code:
> <!DOCTYPE html PUBLIC &#034;-//W3C//DTD XHTML 1.0
> Transitional//EN"
>
> The path is ok, that's where the file is. Of course it
> doesn't contain a DOCTYPE line so where thatone comes from
> is beond me.
>
> The call is made through:
>
> <script language=&#034;JavaScript&#034;
> src={&#034;javascript/screen.js&#034;|ezdesign}
> type=&#034;text/javascript&#034;>
> </script>
>
> which works as it should outside of ez.
>
> Who can shine some light here? Thanks.

Try adding |js to your http conf insert for the site. By default .js files are not allowed. If you add them they then work.

i.e. change
RewriteRule !\.(gif|css|jpg|png)$
to
RewriteRule !\.(gif|css|jpg|png||js)$

While your there probably best to add |ico for .ico files so you can get your favicon working :)

Tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Gerhard Hoogterp

Tuesday 18 February 2003 4:55:23 am

> i.e. change
> RewriteRule !\.(gif|css|jpg|png)$
> to
> RewriteRule !\.(gif|css|jpg|png||js)$
>
> While your there probably best to add |ico for .ico files so
> you can get your favicon working :)

And gif as there's still a lot of it around.. Thanks, completely forgot about those setting.

Kristoffer Karlsson

Wednesday 16 November 2005 4:00:02 am

In which file am I supposed to change this?

> RewriteRule !\.(gif|css|jpg|png)$
> to
> RewriteRule !\.(gif|css|jpg|png||js)$

_____________________________________
Blog: http://www.kristofferkarlsson.com
Website: http://www.spelkanalen.com

Mark Marsiglio

Wednesday 16 November 2005 5:21:22 am

This is either in an .htaccess file in your root directory (enable viewing of files that begin with a period in your FTP client), or your httpd.conf. Unless you own the server and have root access, the .htaccess is the most likely file to change.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

eZ debug

Timing: Jan 18 2025 10:58:19
Script start
Timing: Jan 18 2025 10:58:19
Module start 'content'
Timing: Jan 18 2025 10:58:19
Module end 'content'
Timing: Jan 18 2025 10:58:19
Script end

Main resources:

Total runtime0.8704 sec
Peak memory usage4,096.0000 KB
Database Queries204

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 587.8516180.8203
Module start 'content' 0.00610.7363 768.6719666.6641
Module end 'content' 0.74250.1278 1,435.3359341.0625
Script end 0.8703  1,776.3984 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.4512210.0002
Check MTime0.00150.1672210.0001
Mysql Total
Database connection0.00100.114610.0010
Mysqli_queries0.779289.52212040.0038
Looping result0.00250.29002020.0000
Template Total0.838196.320.4190
Template load0.00210.240220.0010
Template processing0.836096.049220.4180
Template load and register function0.00020.018410.0002
states
state_id_array0.00110.126510.0011
state_identifier_array0.00120.135720.0006
Override
Cache load0.00190.2180860.0000
Sytem overhead
Fetch class attribute can translate value0.00180.205950.0004
Fetch class attribute name0.00160.183180.0002
XML
Image XML parsing0.00370.422250.0007
class_abstraction
Instantiating content class attribute0.00000.002380.0000
General
dbfile0.00570.6605380.0002
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs