Jump to content

Recommended Posts

Posted

how do I get jquery/javascript code online and use it on pw?

I'm trying to port my static html in pw by the way.

post-2613-0-68134200-1412601082_thumb.pn

I successfully used the css code since there are css files included in my template folders which I placed it there.

and used the <?php echo $config->urls->templates?> to make it work. see code above.

however there is a jquery code which is being called online. I know <?php echo $config->urls->templates?> wont work.

So how do I call it in pw? to make the jquery codes work?

it doesnt work if I left it like that by the way.

or should I just download the js files place it on my scripts folder then use <?php echo $config->urls->templates?> way again?

Posted

Assuming you have your Javascript in your templates folder, do exactly as you would for css.

So, if your scripts are in a folder called js, then

<script src="<?php echo $config->urls->templates?>js/jmyscript.min.js"></script>

EDIT:

The trick here is to think of your /site/templates/ folder as the root of your site, with the exception that you need to be explicit about the paths when including script and css files.

So, you might have

/site/templates/

--js

--css

--images

mytemplatefile.php

  • Like 1
Posted

How do you know it's not loaded? 

Try adding this below the call to jQuery

<script>
if (window.jQuery) {  
    alert('jQuery is loaded');  
} 
else {
    alert('jQuery is not loaded');
}
</script>
Posted

What you have hilighted works as long as you have jquery in your js folder.

If you are trying to use it from a CDN, then just call the CDN as you have done.

However, do remember you MUST load JQuery first before any other jquery plugin. So;

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="<?php echo $config->urls->templates?>js/jquery.myplugin.min.js"></script>
Posted

As Nico said - check your console.

So in Chrome, inspect element and then click on the console tab to see what js errors are there.

Posted

Joss

the code works as it is since it is a working template from responsee. when I just use the original html file from the template.

im trying to port it on pw, right now im just changing the path of the files (css, js ) etc.. to make it look like the original template

the problem is i dont think the .js files are being loaded by pw? thats why the slider and the feature slider at the bottom part wont show up

also the logo?

Posted

what does the console say?


Oh, and PW doesn't load the files, your browser does based on the information on the page

Posted

omg i think i got it now?

i think i have to make image field first and upload the images in pw first then call them with api's

gonna try it now

ill get back to you guys if theres still problem

sorry for this im such a noob with pw

Posted

thanks for the help guys kinda figure it out had to make images field then upload then call it using

<img src=<?php echo $page->my_imagefield->url; ?>  />

sorry for the trouble , im such a noob hehe

  • Like 3

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...