do we have to use static-content:deploy for every small change in our custom jascript in magento - admin

i am creating one custom javascript file in magento admin side.i need to use static-content:deploy every time to reflect the change in javascript .so it's taking very long time to see the output.so what is the standard way to use the custom javascript snippet

Suggestion is to have that JS as online JS rather then in .JS file.

Related

Replace Javascript with Bootstrap responsive slideshow

I'm trying to find a nice looking bootstrap slideshow that looks similar to this one: https://www.jssor.com/demos/simple-fade-slideshow.slider
I would use the one in the link but it's got way to much Javascript and doesn't respond properly when I change the size of my window. Any ideas how I could create this using Bootstrap, HTML and CSS only? So it still needs to be automatic as well.
Thank you
It’s the carousel you’re after, without knowing which version of bootstrap you’re on I cannot provide an example but you can find full examples for what you need in the bootstrap docs: https://getbootstrap.com/docs/4.1/components/carousel/

Dreamweaver type templates in Aptana

I am designing a very small website using basic HTML. I usually use a CMS but it has been a while since I did just HTML files, I was wondering if there was some sort templating where you can have like areas like a "Master template" and when a section is changed or added to the rest of the HTML pages that have those sections change with it. Like a common header and footer so I don't have to make the changes in each page if I need to make a change to an element.
I am using AptanaStudio 3 and was wondering if there was a feature like that as there is in Dreamweaver. I don't have Dreamweaver installed on my new computer, so taht is not an option.
Thanks in advance
You can try server-side includes (SSI): http://www.htmlgoodies.com/beyond/webmaster/article.php/3473341/SSI-The-Include-Command.htm

OpenCart: Creating a standalone Ajax page

I'm working on an OpenCart project. I'm creating a "quick view" effect on the special products on the homepage where if people mouse over the item, a popover displays including a bigger image and an add to cart button.
I'm trying to create an Ajax page where I can use in my js to call and get the details of the product.
My ajax file works fine as far as looking at the passed query string and returning some data; I just don't know how I can include the opencart core files, or module files where I can use to get the details.
I hope I'm making sense.
The easiest and best method would be to use the framework itself and simply use the methods provided to get the data you want. You can read the basics about how to use the framework here assuming you are a php developer and have a basic grasp of OOP and MVC

Opencart module development - Inject javascript/html code in some pages

I'm a beginner on Opencart and just started developing a module for Opencart which it must inject some lines of javascript and html code in these pages:
- Cart Page
- Product Page
- Confirmation Order Page
- Register form page
The official documentation doesn't have informations about how can i do that, I've tried to find a good documentation about OpenCart but I didn't find anything.
I need help. How can I do that?
Diggin necro topics;) :
The easiest way i think:
upload/catalog/view/theme/[themename]/template/product/product.tpl - here you can add your custom html for product page
[your theme name, you shouldnt overwrite default theme because it can cause damage after update]
It depends on where you're trying to insert the HTML/JavaScript.
Doing things the proper way in OpenCart, you're limited to the column-left, column-right, content-top, and content-bottom positions.
The files you'll need to create are:
admin/controller/module/mymodule.php
admin/language/english/module/mymodule.php
admin/view/template/module/mymodule.tpl
catalog/controller/module/mymodule.php
catalog/language/module/mymodule.php
catalog/view/theme/default/module/mymodule.php
To learn how to do this the first time, it's easiest to replicate an existing stock OpenCart module (preferably a simple one, such as information). Once you've replicated it you'll need to go through each of those files and replace any references to "information" with "mymodule".
After that, if you've done it properly, you should be able to navigate to Admin > Extensions > Modules and see your module in there. Then install it, use the "Add module" button to position the module on all the relevant layouts, hit save and hey presto you have a working module on the front-end.
To modify the front-end output, just edit catalog/view/theme/default/module/mymodule.php
If you want to insert your HTML somewhere other than the 4 available positions OpenCart gives you, position your module in the content-bottom position and use JavaScript/jQuery to inject some HTML where you want.
If this is for your own personal website then as Pawel S suggested it would be easiest to simply modify the relevant view files (ie. catalog/view/theme/[themename]/template/product/product.tpl), however if you're making a module which you plan to distribute then this should be a last resort.
Hope that helps!
I realize this is probably long dead by now, but if you're creating a module that needs to modify existing controllers, languages, models or views the correct tool to use is vQMod.
vQMod allows you to modify existing code on the fly using XML.
https://code.google.com/p/vqmod/

How to ensure that a javascript file is included only once in Django

I have a few child templates which have extraheads which include the jquery script. Sometimes they are used together. How can I have the jquery javascript file loaded only once? If it were convenient to set template variables, I could set and check one before including the line.
My advice: Just include jQuery on your base's <head> and call it a day. Saves you from having to worry if a child template uses jQuery or not and it is just a 19kb download on the first page load and that's it. If you use Google's API cloud, it may not even be any as the user might have it cached from another site.
This may not work for you, but I advice you to consider it if possible.
My usual approach to this problem is to either wrap all of my child templates in one template that takes care of my includes (JS and CSS). I then make sure my caching is set properly, so that these scripts are only downloaded once per user. In other words, I force the download of all my external scripts on the first view, then rely on caching to not redownload the JS each time.
Combining all of your JS into one file will also improve download time due to the reduction in requests that will be generated.
Another thing to note is that you mentioned putting the JS in heads. While most people do this, placing JS in the head can make your pages appear to load slower. JS files are not downloaded in parallel, so they block all other downloads. Google and Yahoo recommend placing JS at the bottom of your page where possible to improve the user experience.
See the Yahoo YSlow tool and the Google PageSpeed tool for this.
I'd mostly bite the bullet and load jQuery with every template. But if you really really really have to have this feature, then I'd recommend a custom template tag. Check out the docs, especially the part about setting a variable in the context.
You could define separate blocks for your script and for other extraheads in base template.
In base template leave block for your script blank. Fill it with link to a file when needed in templates which are extending base.
You could pass all required files as a context variable and then write a template tag that removed duplicates and loaded what was left.
You could control load order this way also.