Change URL in link after code has been output - javascript

So, I have a dotNetNuke site that was developed by someone else. These developers are not available to respond to requests as fast as I need in this case, and I have to fix something on a customer's site ASAP.
Somehow, the Home link in the site's side nav is pointing to the Contact Us page. Not sure how this was done, but I have limited access to the backend of the site (what's there is a mess anyway).
I'm looking for a way to change the URL of the Home nav item only from http://www.mywebsite.com/subdir/ContactUs/tabid/2530/Default.aspx to http://www.mywebsite.com/subdir/. I've tried swapping out the text with JavaScript to no avail. Does anyone have any ideas?
Any help would be greatly appreciated. Let me know if you need more info.

As lostPixelx suggest and seeing it kind have some hack that DotNetNuke do to the the link work. Please add the following to a javascript
$(function() {
$('#tddnn_dnnMENU_ctldnnMENU2529').click(function(){self.location="http://www.mydomain.com/subdir/"})
});

I would recommend you go in to the PAGE SETTINGS for the HOME page via the Admin/Pages (page management).
From there, on the last "tab" in the settings, towards the bottom, you can find a "URL" or "Navigation" Section, make sure nothing is selected there, then save the page settings.

Running this Jquery code will remedy your issue... but it seems like your site has some issues that you should address, not bandage with JS.
$('h1.logo a').attr('href','http://www.mydomain.com/subdir/');

Related

js corrupt file only working on some pages

I am making a magento webshop, but i have run into some problems with the theme i am using.
I bought it on themeforest, and i have asked the developer for help, but it takes ages for them to answer and come with a real solution to fix the problems, so now i am seeing if someone here can help me solve the problem.
The webshop: http://new.webhipster.dk/index.php/home-left
When i add items to basket ("Læg i kurv"), it only works on the front page (the link listed above). When i go to another page, it won't add the item to basket. (e.g. http://new.webhipster.dk/index.php/roedvin.html)
So my guess is that there is a corrupt js file, but what i don't understand is, that it is the same code which is generated in header on both pages - but still it doesn't work on any other page but the frontpage.
How do i figure out what js file is corrupt and isn't loaded properly?
I have gone trough each one to see if they load, and it seems like they all load exactly like they do on the frontpage.
I guess you are missing a library required for it or might be css. As error in your console window say that it could not found css property.
Because when I tried accessing url directly from browser it's adding items into cart
For Example you are calling -
setLocation('http://new.webhipster.dk/index.php/checkout/cart/add/uenc/aHR0cDovL25ldy53ZWJoaXBzdGVyLmRrL2luZGV4LnBocC9ob21lLWxlZnQ,/product/2/form_key/1Tfx79G6V33Q7l2Q/')
Now try accessing it from the url something like
http://new.webhipster.dk/index.php/checkout/cart/add/uenc/aHR0cDovL25ldy53ZWJoaXBzdGVyLmRrL2luZGV4LnBocC9ob21lLWxlZnQ,/product/2/form_key/1Tfx79G6V33Q7l2Q/
and this will add item in your cart.
Now you debugging should start from function setLocation(). Try doing file search for setLocation function. and check where it is failing.
Hope this will help you atleast for debugging.

Scroll webpage based on url

So I'm building a website that's basically one page but the links at the top just scroll to a different location on the page. Here's an example: http://evanstoddard.site90.net.
If I were to give a link to, in the example above, the about page I would simply give that person a link that looked like http://evanstoddard.site90.net/#about and that link would go to the about section of that website.
Let's say I wanted to do the same thing except instead of adding the '#about" I would use /about. So it would end up looking like http://evanstoddard.site90.net/about but do the exact same thing as #about. This would be better for SEO I'm assuming.
Any help would gladly be appreciated. Or even a "you're crazy... it will never work" ;)
Long story short, I want to display 'http://evanstoddard.site90.net/about' and have it do the exact same thing as 'http://evanstoddard.site90.net/#about'
You're not crazy at all and it will work :)
You should edit your .htaccess so that everything after your domain would be sent to the same page (index.php I assume) as GET params and work from there.
Now you can get the URL on page load using javascriptO OR "digest" the parameters in PHP and output it to the client side.
jQuery scrollTo might help you with scrolling to whatever you need.
That's how it might be done in .htaccess (that's how it's done in Kohana):
RewriteRule .* index.php/$0 [PT]
And this should help you with scrolling.

Clearbox JS "messages"

I am currently running Clearbox JS on my site so that users may view a larger version of an image once they have visited the images page. Now, I just recently implemented this and I have noticed that on every single page at the top of the page Clearbox JS echos the command that it is doing. Whether it be initializing, or viewing an image, or event rotating an image. I really do not want this message popping up at all. I would much rather being required to put a link somewhere on the website to the developers website then having to deal with this. If anybody knows how to remove this, please answer. I am providing a link to the website so that you know what I am doing as well as a pastebin link to the clearbox.js file which is the config file.
website: www.dsdwebdesign.net/bootstrap_apgnew/index.php
pastebin: http://pastebin.com/NgBgc34X
Try this somewhere in your page, or the cb_style.css file (but make sure you read their conditions, I am not sure if you are allowed to do this with this piece of software):
#CB_OSD{
display:none!important;
}
It should hide the box at the top.

Javascript linking to other pages

We're running over a problem here. We have a website which shows a header, content and a footer. Now, when clicking on a link we want just a part of the site (content-part) to be refreshed to save some traffic. The header and footer should stay as they're. We tried to use the following script for that:
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
Well, the script is not doing great on our site. Any other JS-Code does not get executed at all. The GET-Tags in the URL are not displayed aswell. Everything else works with that script.
Do you have knowledge about any other alternatives to this script?
Regards,
I agree, Ajax is the way.
You can include jQuery.
Have a look at these links.
http://api.jquery.com/jQuery.ajax/
In particular jquery load() function
$('#result').load('ajax/test.html');
a little jsFiddle
http://jsfiddle.net/james_nicholson/c6dpn/5/
please note: $("#content").load("a/html/page/that/should/be/on/your/server");
.load(); <- needs to have a local page, PHP and or HTML will do.
http://api.jquery.com/load/
When you say 'Any other JS-Code does not get executed at all', do you mean at any time from when the page loads initially, or only when the content part is refreshed?
For dynamic adjustment in javascript i would recommend http://angularjs.org/ or http://knockoutjs.com/ , try this out and work through tutorials and you will see how easy it is to change everything without refreshing.
I'd say you only need AJAX if you get some data from a database. Otherwise it's enough to work with AngularJS or KnockoutJS. Have a look at it!
Regards

jQuery 1.7.1 slider not working except on homepage

I have tried to place the slider on every page on this website: http://atripathi.com
It works on the homepage, but doesn't work on any of the other pages (About, Services, etc.)
I know it's probably an easy fix, but I can't get it at the moment.
Thank you for any help or suggestions!
Looks like the original suggestion above is correct. I'm seeing slider javascript includes at the top of your homepage that aren't on the other pages.
Generally, a good way of troubleshooting is to make copies of both pages, index-c.php and about-c.php perhaps, and start removing everything that isn't pertinent to the trouble you're having (other HTML, css includes, etc.) until you get down to only the slider on the page. Once you've done that, you might notice that the one page is slightly different than the other, making it work. You can copy back and forth until it does.
The other possibility is that there's a relative path problem somewhere, because your one page is inside a folder (though I'm guessing you have a .htaccess redirect to a root folder page)? So if all else fails, move the reduced about-c.php to the root folder and see if that then works. If so, you know it's a path problem.
Hope these suggestions help.
I see that jQuery is being included on all your pages but the cycle plugin is only included on the home page. You should be able to update your template(s) to fix this.

Categories

Resources