I'm considering adding multiple languages to my website and looking for ideas on how to possibly implement. My website is static however and I'm curious if there is a way without PHP to allow the website to flip between different languages via a button. I've seen various questions asking how to do this task using PHP, however can it be done without PHP?
For example, can a static website switch between different languages in the same way that a webpage can easily swap stylesheets using javascript or jquery?
There are several methods you can use. One way is to adapt the script used here:
How do I toggle multiple divs individually?
You can place all the translated text in one page but hide them in separate divs such that only one div shows. Then you can hook button click events to change the visible div whose language you would like to show.
An alternative is to implement AJAX calls to retrieve different html pages depending on the selected language.
Related
I'm building a website using the ACF plugin (Version 5 Pro), and I'm setting up a button on a page template, which by itself isn't the problem. The problem is that depending on the specific content of each individual page using that template, the button can have one of several different appearances. What I'm trying to do is set things up so that I can upload all the buttons into the default value section of the ACF field ahead of time, and then every time I make a new page using that template, simply select the appropriate button from a radio button, a dropdown menu, or something similar on the backend of the page. I plan to be constantly uploading small amounts of content using this template, so not having to manually select the appropriate images on each page would save me a lot of time.
I've googled around and there wasn't a good answer I could find anywhere, so I'm hoping one of you more knowledgeable folks could help me out!
(And before anyone proposes this as a solution, no, the content of each page isn't something I can define just using programming. It's a little more abstract and needs human input. If all else fails I can just make multiple templates and simply select the appropriate one when I go to make a page, but the way I'm trying to do it now would be a lot cleaner).
You can try ACF Flexible Content:
https://www.advancedcustomfields.com/add-ons/flexible-content-field/
Using Flexible Content field, you will be able to create multiple fields (button 1, button 2, etc) including a WYSIWYG editor and build the buttons HTML adding the default value of the field.
You can read:
https://support.advancedcustomfields.com/forums/topic/html-default-values/
However, I think you'll get in trouble making your buttons dynamic with this approach... so I'd suggest it will be better if you keep some parts of the buttons (like URLs) dynamic, using an extra field to enter the URL, anchor, etc.
Here is my problem.
I am attempting to have a way to help teach people about css selectors and various html pieces by allowing them to go to a website of their choosing, selecting an html element from that site, and me displaying to them all the properties of that element. Basically show them how to generate css selectors to retrieve that element etc.
Problem is, using iframes/object tags/etc do not allow you to access the page inside from your page. So I have no way of determining when the user clicks in any buttons or anything inside the other page.
I am open to pretty much any suggestions, I have thought about Java applets, or Java web start. But I wanted some professional opinions on the topic.
Is it possible at all using only Javascript or various Javascript plug ins etc?
Is it possible using a Java applet or some variation of?
At my company, we are debating this. Say you have a color swatches that is already built in product detail page. At the category page, where each products are displayed, doesn't have color swatches. So we are trying to build one. I was suggesting if we can use jquery or javascript to crawl it, cache it or drag it from the pdp and display it in category page. If we do that, it probably gonna be very slow because the category page is going to hit the server many times.
Additional info, we don't have access to the php codes, so only javascript, jquery and html is possible.
I am actually looking for a way to do that. of course, it has to run fast too. Any suggestions of possibility anyone?
i dont think it is possible, your jquery or javascript should be native to the page to read its contents, ok lets assume it is native and you can read the content but where do you store ? with only javascript and jquery and not much of server side it is impossible
I am developing some javascript code that will replace a standard select element with a javascript controlled dropdown menu which will redirect users to a particular page. The standard select element must work when JS is disabled
An example of what I want to achieve is here: www.play.com
What I have noticed with this site is that they simply position the select element behind the javascript alternative. This means that both controls are available to screen readers and keyboard users.
Does anyone have any experience of setting such functionality up and have any suggestions for the best methods to ensure accessibility?
Plain links would be your starting setup, as they work to take users to new pages without any additional scripting required.
You can put them in a container ul, and then use javascript in a 'progressive enhancement' way to turn the list into a dropdown (by re-writing the html) for the people who've got it turned on. This way, a user without javascript turned on will have no problems, and the majority of users will see your drop-down menu.
Even better, don't use a select menu for navigation. It's not really semantically correct, and requires more work to make it operable and robust.
Try something like the Suckerfish drop-down menus which are based on nested lists: http://www.htmldog.com/articles/suckerfish/ or if you want a bit of jQuery fun: http://users.tpg.com.au/j_birch/plugins/superfish/#sample1
I'm writing a web site with several forms of dynamic content. For instance, at the top, there are tabs for controlling which parts of the site are displayed below. And in a couple of pages, there are multiple select/option lists which change based on what has been selected in other select/option lists. Right now, I'm doing all of it with divs. I'm wondering if I should change some of it to frames. Are there other methods of changing this content? And when should I use what?
Thanks.
EDIT
To be more clear about my methods, when I say I'm "using divs" I mean I'm putting my content inside div blocks and updating them with jQuery.
None of the things you mentioned require frames.
Frames are from the past;-)
DIV's make a lot of sense for everything layout related.
Use javascript to do the dynamic option list thingies (either hide() or show() them using jquery or use ajax to Load the different lists into the page)