im using wampserver on windows 7 and have wordpress set up. I am trying to include a js file using a couple of methods but the server is adding extra locations..
e.g. using wp_enqueue_scripts outputs:
wp_enqueue_script('qtip', AD_PATH.'/js/qtip/jquery.qtip.min.js', array('jquery'), false, true);
AD_PATH outputs correctly on screen when echo'd: C:\wamp\www\market/wp-content/plugins/market
but in the chrome console, http://localhost/marketC:wampwwwmarket/wp-content/plugins/market/js/qtip/jquery.qtip.min.js?ver=3.9.2 appears.
using
<script type="text/javascript" src='localhost/market/wp-content/plugins/market/js/qtip/jquery.qtip.min.css'></script>
outputs
http://localhost/market/merchant/register/localhost/market/wp-content/plugins/market/js/qtip/jquery.qtip.min.css
this prepends the current page location to the src.
I had a problem with the wampserver index file not including localhost and changed $suppress_localhost to false and $projectContents .= '<li>'.$file.'</li>';
anyone any ideas?
To solve your problem edit your wamp/www/index.php file. At line 30 there is:
$suppress_localhost = true;
Change it to:
$suppress_localhost = false;
Related
I am using the NToastNotify nuget package (v7.0.0) with .NET core 3.1.
services.AddMvc(options =>
{
options.EnableEndpointRouting = false;
options.Conventions.Add(new RouteTokenTransformerConvention(
new SlugifyParameterTransformer()));
})
.AddNToastNotifyToastr(new ToastrOptions
{
NewestOnTop = true,
TimeOut = 10000,
ProgressBar = false,
PositionClass = ToastPositions.BottomRight
}, new NToastNotifyOption()
{
ScriptSrc = "/js/toastr.min.js",
StyleHref = "/css/toastr.min.css"
});
I have added the app.UseNToastNotify(); middleware in the Configure method as well as added the #await Component.InvokeAsync("NToastNotify") bit in the body tag within the layout page.
Everything works perfectly on development, but on production when it tries to download the JS file it return a 404. As you can see I have also tried to override the script source, but still no luck.
The #await Component.InvokeAsync("NToastNotify") part will actually render the following
<script src=/_content/NToastNotify/toastr.js?7.0.0.0 type="text/javascript"></script>
<script>
if (nToastNotify) {
nToastNotify.init({
firstLoadEvent: 'DOMContentLoaded',
messages: [],
responseHeaderKey: 'X-NToastNotify-Messages',
requestHeaderKey: 'X-Requested-With',
libraryDetails:{"varName":"toastr","scriptSrc":"https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js","styleHref":"https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css","options":{"positionClass":"toast-bottom-right","timeOut":10000,"newestOnTop":true,"progressBar":false,"type":"success"}},
disableAjaxToasts:false
});
};
</script>
I will get the following two errors GET https://xy.hu/_content/NToastNotify/toastr.js?7.0.0.0 net::ERR_ABORTED 404 and Uncaught ReferenceError: nToastNotify is not defined
The whole site runs through Cloudflare. I am not sure if that is the reason why it don~t work on production. By the way this _content folder does not exist on any environment and is download somehow by the nuget package.
According to the error message, I guess this issue may be related with the Cloudflare hosted folder path. To avoid this issue, I suggest you could try below workaround.
You could add the reference manually in the view, like below:
<script src=https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js?7.0.0.0 type="text/javascript"></script>
Or directly download the script and add the relative path.
I just downloaded a fresh copy of tinymce, uploaded it and tried to use it on my UTF-8 encoded website.
The menu bar icons are either garbage because it can't find it's presentation file (font?) or the encoding of one of the 10000 files is wrong.
Anyone knowing this bug? I didn't change anything, just uploaded..
TinyMCE doesn't use my german lang file either, obviously. I placed the js file into the "langs" folder.
<script type="text/javascript">
tinyMCE.baseURL = '//example.com/de/assets/scripts/tinymce';
tinyMCE.suffix = '.min';
tinymce.init({
selector: "textarea"
});
</script>
Do I have to set any configuration for path, basepath, ... ??
My actual path to tinymce is scripts/tinymce/tinymce.min.js. The origin path provided by the shipped package was tinymce/tinymce/js/tinymce/tinymce.min.js but honestly this kind of nesting folders without any reason..
update: The paths are working, it does read files not directly linked.. (like theme.min.js) successfully.
I recently had to start making small changes to an existing site so I downloaded it and tried to run it but get an error:
Call to undefined method sfContext::getController() in
/home/user/www/site.com/web/index.php on line 16
I tried to figure out which file is being loaded by inserting these lines with this command in index.php right before the dispatch call.
$reflection = new ReflectionClass('sfContext');
$classFile = $reflection->getFileName();
die($classFile);
sfContext::getInstance()->getController()->dispatch();
And it looks like file loaded is:
/home/user/www/site.com/lib/vendor/symfony1.0/test/unit/sfContextMock.class.php
This symfony1.0 site works fine on original server but not on my local machine.
I checked php version and php.ini and they are identical. I cant figure out why wrong class is being loaded or what the problem is.
Here is the index.php file
<?php
define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/..'));
define('SF_APP', 'front');
define('SF_ENVIRONMENT', 'prod');
define('SF_DEBUG', true);
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
sfContext::getInstance()->getController()->dispatch();
You should update to the lastest one available (1.0.22).
I have a WebForms app that I'm converting to MVC, but for now running legacy stuff side-by-side.
For some reason, the ScriptManager left to it's own devices tries to load the following files from a very strange (and non-existent) location:
<script src="Scripts/WebForms/MsAjax/MicrosoftAjax.js" type="text/javascript"></script>
...
<script src="Scripts/WebForms/MsAjax/MicrosoftAjaxWebForms.js" type="text/javascript"></script>
I can't find the setting of that location, and googling "Scripts/WebForms/MsAjax" brings back nothing.
Changing the (obsolete) ScriptPath property on the ScriptManager does nothing to help with these two scripts.
Trying to override the Path location like the following also does not work (it just tries to load both scripts)
Scripts.Add(new ScriptReference { Name = "MicrosoftAjax.js", Path = ContextUtil.MapApplicationPath("~/My/Script/Location/MicrosoftAjax.4.0.js") });
Scripts.Add(new ScriptReference { Name = "MicrosoftAjaxWebForms.js", Path = ContextUtil.MapApplicationPath("~/Shared/Scripts/Legacy/MicrosoftAjax/MicrosoftAjaxWebForms.4.0.js") });
What I can't understand is
Why is it not loading the scripts by default from a Embedded Resource?
Where is this strange path coming from?
Why won't it accept my overridden script paths?
Can anyone help?
I am using Xcode 4 with PhoneGap (Cordova 1.6) and ChildBrowser. I've used SiteCrawler on OSX to successfully download a website and localize it, and it is fully browsable locally with images, PDFs, etc. I have moved all the localized site files into the PhoneGap www folder and the app test builds fine - the site is fully browse able.
I want the PDFs on the site to open in their own window, and ChildBrowser does this perfectly as far as my needs. Using http://blog.digitalbackcountry.com/2012/03/installing-the-childbrowser-plugin-for-ios-with-phonegapcordova-1-5/ I was able to get ChildBrowser installed and working - I have PDF files opening in the ChildBrowser.
My problem is that using the link above, I have to add ontouchstart="loadChildBrowser('/path/to/file.pdf'); return false;" to every PDF link on the site. Since we use a CMS, this isn't much of a problem - the bulk of PDFs are called from a template with data filled in from the CMS and they are fine. But there are some pages in the site where the client has added a link to an uploaded PDF into the content of the page. In this case, there is no easy way to add the above code to the inline link.
I figured that I can use jQuery to look at each a tag on the page when clicked and if clicked, run the ChildBroswer instance, and this would cover both types of PDF links, but I can't seem to get it to work. Here is what I have:
<script type="text/javascript" src="/a/js/cordova-1.6.0.js"></script>
<script type="text/javascript" src="/a/js/ChildBrowser.js"></script>
<script>
// install ChildBrowser
var cb = ChildBrowser.install();
//loading a web page in ChildBrowser
$('a[href$=pdf]').click(function() {
var href = $(this).attr('href');
cb.showWebPage(encodeURI(href));
return false;
});
</script>
Using the above with no inline link javascript, the PDF opens on its own, without child browser.
Using the below along with ontouchstart="loadChildBrowser('/path/to/file.pdf'); return false;", child browser will open, and for some links shows the PDF, and for others just says loading. I figure this is just tweaking for paths, but I think the above would be most universal if it can be made to work.
<script type="text/javascript" src="/a/js/cordova-1.6.0.js"></script>
<script type="text/javascript" src="/a/js/ChildBrowser.js"></script>
<script>
// install ChildBrowser
var cb = ChildBrowser.install();
//loading a web page in ChildBrowser
function loadChildBrowser(file) {
cb.showWebPage(encodeURI(file));
}
</script>
Through trial and error I was able to get this working for the most part. I'm still hitting a couple of unrelated bugs (well, related to Childbrowser but not the loading go local PDF files).
So, using ontouchstart="loadChildBrowser('/path/to/file.pdf'); return false;" on all links to PDFs on the site is still the way to go. What changed was the JS function I am using to determine the path to the PDFs and launch ChildBrowser. I had to do this:
<script type="text/javascript" src="/a/js/cordova-1.6.0.js"></script>
<script type="text/javascript" src="/a/js/ChildBrowser.js"></script>
<script>
// install ChildBrowser
var cb = ChildBrowser.install();
//loading a web page in ChildBrowser
function loadChildBrowser(file) {
var path = location.pathname+file;
var len = path.length;
var locleft = path.indexOf('/www/')+4;
var trim = len-locleft;
var left = path.slice(0,-trim);
var locright = path.indexOf('/assets/');
var trim = len-locright;
var right = path.slice(-trim);
var finalPath = left+right;
cb.showWebPage(encodeURI(finalPath));
}
</script>
in my included header file (so it lives in the head of every page on the site). The problem was that when ChildBrowser pulled up the path to the file, it was appending the part below the normal site's web root (/assets/documents/xxx.pdf) to the full path to the page being viewed in the app at the time, so I ended up with:
/var/users/name/blah/blah/www/page.html/assets/documents/xxx.pdf
when we wanted:
/var/users/name/blah/blah/www/assets/documents/xxx.pdf
The script above prepends location.pathname to the file var passed from the function (ontouch start) that calls ChildBrowser so that we end up with
/var/users/name/blah/blah/www/page.html/assets/documents/xxx.pdf (not correct)
It then splits it into a left section (everything before /www) and a right section (everything including and after /assets/) and then concatenates them (effectively removing all the site directory and html file information) and then calls ChildBrowser with that finalPath. Working for me.