I have two links on a page.
When the user clicks on one link, I'd like to set a ColdFusion variable, and when they click on another link, I'd like to set the variable to something else.
Is this possible to do? I'd like to avoid a JavaScript solution because the contents of the variable needs to be (semi) secure...
Have you tried adding a URL parameter to the link? (index.cfm?link=foo vs index.cfm?link=bar)
Then when the target page reloads, you can use a cfparam variable:
<cfparam name="var" default="">
An Adobe example follows:
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7faf.html
Related
Sorry if this question was mentioned. I have web page with bunch of javascript files. One of it has function that sets value to some input on HTML file. Is it possible to see via debugger which javascript function invokes changing of value of the input HTML element?
Right click on the input tag that you are willing to observe and select Break On and then Attribute Modifications. Your scripts will stop if they try to modify the input value.
I have a blog where I want the user to click a link to be able to invert the colour scheme (from dark on light to light on dark). This link will be available on each page of the blog.
If I wasn't using CodeIgniter, I would create a link with a parameter (e.g. "index.php?inverted=true") and in my controller detect if $_GET['inverted'] was set, set a $_SESSION variable. The link would be changed and the additional CSS file would be added when $_SESSION is set. The link's new href would be something like "index.php?inverted=false" and the $_SESSION variable would be unset. It would work site-wide and regardless of the rest of the URI.
I've tried using the uri_segement functions in CodeIgniter, but because this needs to be across the whole site, my URIs change (sometimes just "index.php/controller/function", other times "index.php/controller/function/para1/para2/para3"). Therefore I can't just make my link: [href="$_SESSION['REQUEST_URI'] . "/inverted"] and then detect if that URI segment exists because I don't know which number the segment "inverted" would be. Also, if a user is on the same page and clicks the link twice, the URI keeps adding "/inverted" again and again.
I made a mock form so I could use the $_POST array instead, but I know this isn't good practice.
Any suggestions?
Make the link submit a form via POST as you described, then set the SESSION variable, after that, issue a redirect to the referring page (HTTP_REFERER). You can do something similar to toggle this option off.
I was wondering if any of you can tell me how I can put the time in my website's tab. Heres an example: http://blog.wearebuild.com/
As you can see on the top (where the title is), it says "Build - We do Print - 22.10"
I am using DreamWeaver to design this website.
Thanks in advance!
You have to use JavaScript to modify document.title to dynamically alter the page's title. If you want to insert the date/time you can use JavaScript's Date object.
So I have a website that has just two pages. On the home page, there are some things going on, but are not important. There are some links, however, that will need to link to a specific piece of content on the second page.
On the second page, I have content on there and it's all encased in the jcycle plugin.
What I need to do is if someone is on the homepage and they click on a link, it needs to load up the second page and show the correct "slide" that corresponds to what the homepage link is.
If you need any more clarification, please let me know.
In the cycle options reference, I see that there is a startingSlide option. You could set that dynamically. You could either do it with server-side code, e.g. /foo?slide=3 or you could check which anchor reference was used on the incoming link, e.g. /foo#slide3. Or, you could use DHTML to build the slideshow on the homepage when they click the given link.
Also note that there is a slideExpr option that you could use to filter the slides to a smaller set, depending on what they selected.
In my app I have a list of products and when you click on a product, a Fancybox opens to show the product details.
Now when the user closes the Fancybox, I change the URL back from '#/product-name' to '#' and the list of products is rendered again, even though it is already there.
My question is:
How do I avoid the product list from being rendered again?
So somewhere either in the list action of my controller or the list view I want to check if the product list is already rendered and don't render it again.
It feels like something that should be possible to accomplish quite easily but I can't get it right.
All ideas appreciated!
EDIT: edited for clarification
Have a look at backbone:s saveLocation method. It doesn't trigger a hashchange event.
You only need to change the hash part of your url.
window.location.hash = ""