I am creating a project in Django, and I am using the Django Admin pages along with TinyMCE. But I would like to be able to toggle TinyMCE on and off like in this example:
http://tinymce.moxiecode.com/examples/example_01.php
but since the admin page is generated automatically I imagine I need to overide the base_site.html template which I can do. But my question is "Is there any way I can have something like -- if is textarea ..... -- in javascript?"
Thanks
You can use
document.getElementsByTagName("textarea")
to return an array of all the <textarea/> elements. Then iterate over it and do with it as you will.
Related
So I am making a quote website and i want to link each Author to a page where I can set his/her quotes so should I make a single html page for each one of them or there is an easy way to do that, ty
Yes, there is an "easy" way to do that.
It depends of what do you use to create this website.
Did you use any kind of CMS like WordPress? Or you are still using only HTML, CSS and Javascript?
In the second case, you will have do some back-end app to bring this dynamically.
I have searched ALOT for this question and didnt find an answer,
I designed a complex HTML template and I tried to make a Joomla template based on it
I found the whole process time consuming and I cant get exactly same result as I wanted, also even If I do this I dont have a user friendly Joomla panel and for changing every module and component the Admin should know a basic HTML understanding to edit my tags and doesnt mess up my code
so I realized what If I use modern Joomla template instead with a user friendly panel
and bring the content to the page and rewrite the whole DOM via Javascript like this
1)first make variables and store the content on the rendered template
2)$('body').innerHTML = "" (make the DOM empty)
3)$('body').innerHTML => rerwrite my structure using variables I stored
then every element is exactly the same and my css, js files do the rest
Is it usual to do this way?
whats the problem with this method?
Thanks
I want to get the value of the inserted liquid objects. But all I'm returning is the actual text and not the values. But if I just manually insert that same div into the head and just run the logging to the console, it works fine.
I think this is a timing issue, but I can't figure it out. I am able to insert this div into the head of the pages on this shop test-4658.myshopify.com
I am appending it to the head like this:
$('head').append('<div id="todd" class="{{customer.name}} {{shop.domain}}"></div>');
I confirm it by looking into the web console, but instead of getting the liquid object values, I'm just getting the text. I'm logging that to the console like this:
$(function(){
var name = $("#todd").attr('class');
console.log(name + " me");
});
Where did I go astray?
Here's a Shopify forum thread that discusses using Liquid variables in JavaScript that should help: https://ecommerce.shopify.com/c/ecommerce-design/t/using-liquid-in-javascript-trying-to-get-collection-title-in-jquery-callback-53043
Feel free to use customer.name in your JavaScript, simply do so in
your Liquid templates, not in a .js.liquid file. You can totally use
JavaScript in your theme's templates.
Seems like it comes down to how you implement the JS with those tags.
I want to create a site like any other. I want the "thing" at the top (home downloads and stuff) to be on all my pages. Do I need to copy and paste the same code over and over again?
put the common part in your header/some specific file and use ,since you will be using header/some specific file on all pages so the desired content will also be loaded.
Learn Psd to html conversion For batter understanding the divs and styles modification and customization.. your divs and tags can be easily maintained with your stylesheet by giving id and classes you can also give one dive multiple classes and ids,
you are talking about master page i think
that is one in style and in that page you're showing other page, likely we can say one template page and many functionality see this and
see this
As far as I'm concerned pretty much all the intelligent options for solving this problem are mentioned in this question
Use a server-side template (e.g.php), use a client-side template (e.g. handlebars), use javascript, or you could use a static site generator like Jekyll.
I am new to Drupal and am trying to create a node (let's call it child) that will only really be accessed when clicked on from another node (we'll call it parent). When closing the child window, I want to parent window to refresh.
Outside of Drupal, that's easy:
<a onclick="window.close(); window.opener.location.reload();" href="#">Click to close this window</a>
However, when I type this into the body of a node using Full HTML, it still strips the onclick text from my post. How can I include javascript in the body of a node like this? Is there a special module I need.
Thanks!
You can customize input filters and make your own, to provide more options.
Using the PHP input filter is not a good idea unless you really want to input PHP.
Also you might not want to give all admins that should make links with JavsScript access to writing PHP code on the site.