I'm a little confused as to what exactly is going on here. For instance...
http://bidstick.com/latest/21249%7C21250%7C21252.js&localtime=1263468042061/
Is pulling down some JSON information, and the numbers being passed are specifying which auctions need information, but what is processing these variables. Is there some server side script that generates the JSON? It appears to be dynamic, as you can manually change the numbers and get a different response. I.E. just change any of the numbers in the link and it will provide different information. Thanks in advance.
I think what is puzzling you is: how does the response change when the parameters in the URL are changed?
If so, here's your answer:
Server side scripts are generating the output that you see. These scripts read the input URL and know what parameters to work on. (More accurately, these parameters are GET arguments). So a server script can read this, and decide what to do accordingly.
PS: now I come to think of it, you must be knowing all this, since you already know what JSON is.
EDIT:
Such scripts are not for the perusal of users of the website. This output is for use by the website itself, or for use by other websites.
To accomplish this: there are two ways I can think of:
URL rewriting
processing PHP inside a .js file (yes this is possible).
You can do that by telling Apache that .js files should be processed by PHP
I believe that can be done using the AddType directive of Apache's config file.
Yes, there is a server-side script that is generating some kind of JSON-serialized output. Both ASP.NET MVC and Ruby on Rails have really simple ways of generating JSON results from what look like standard URLS.
Related
I have three different domains all on the same server and I want to run the code on all three domains from one source on the same server, but not sure the best way.
Here's what I have:
domain01.com
domain02.com
domain03.com
domain04.com/sourcecode
I want domain01-03 to run the code inside domain04.com/sourcecode so the user can go to their domain and not have to go to domain04.com to see their site. I want to keep all the code inside domain04.com because I don't want to have to put the code inside each domain every time I make a code change.
For whatever reason I can't get my head around the best way to do this -- and want to do it right.
Any advice?
Thanks!
All you need to do is create a mapping on the first three sites to the appropriate directory in the fourth site, eg map /domain04 to /full/path/to/domain04/sourcecode, then refererence its CFML resources via /domain04 in CFC and include paths. The inference here is the code does need to be accessible via the file system for all sites concerned.
Note that if you also want to server non-CFML files via HTTP (eg: images, css, js), then you will also need a web server virtual directory along the same lines.
None of this requires a framework, it's standard CF / web server functionality.
Are you using a framework? One like ColdBox could make this trivial if your code is written modularly. (Disclaimer, I am affiliated with ColdBox)
If not, it really depends on what the code is. CFCs can be mapped anywhere via ColdFusion mappings. Even .cfm files can be included as long as the file systems are visible. If you're wanting to basically have complete copy of a site in another web root without duplication, I would first consider using a shared source control repo and a build process that checks it out in the appropriate places, and secondly a good old, symlink will also work .
Using the jQuery wrapped version of Fineuploader v3.3.
Is it possible to populate the file list with files already in the upload folder?
I think "_addToList(id, name)" should do the trick, but I can't get it to work. Any ideas?
Seems that they are currently working on this feature:
https://github.com/Widen/fine-uploader/issues/784
So, this will be available soon.
This is not a behavior that Fine Uploader currently supports. Fine Uploader only displays files that users have submitted to the uploader since the current uploader instance was created. It doesn't try to be an all-in-one web application. You could probably add your own item to the list/UI via javascript. That probably wouldn't be terribly difficult, but seems like an odd thing to do.
If you'd like to discuss your specific use case more, please open up a feature request in the Github issue tracker.
Generally, client side code cannot add stored or hard-coded path based file names for use in any type of POST or upload operation. Obviously this is a security measure, you can imagine if a malicious web page could add to a generic POST operation some type of baked in file name. So from what I understand, only the user can specify path based file names, via a file browser for the session that it is included in. This applies to HTML/JavaScript/jQuery but am unsure if Flash/Silverlight based solutions would also be limited. I think a Java based uploader would be free of this. But you are just moving closer and closer to installed software.
I believe Smarty templates has functionality built in that allows you to manage your site URLs from a config file so if something gets moved, you only have to update the URL in one place. Does this sort of functionality exist in CodeIgniter? If not, any pointers or examples on how/where to add it?
For example:
Instead of hard-coding the link it would be: Settings
But where would you want to set $links so that it was available everywhere? Or is it really best to just hard code them?
Take a look at the config class. It allows you to make custom config files.
It's not entirely made for URL's but you sure can use them.
The base url should be basically right at the start of /app/config/config.php, where app is the name of your codeigniter application folder. You access it through calls to the base_url() function.
Yes, it's called Routes, configuration located at config/routes.php. Documentation
If you ask about the rendered html of the links, then your best bet would be using site_url() in conjunction with constants, for example site_url(URL_SETTINGS);, there is no built in functionality for that, but I can say I don't think that is necessary as it would be used too rarely, but it would influence performance every single load.
I am creating google chome extension and everything is fine, but i need to know the way to use ajax requests more freely, it should be in the same domain (request) or in the file of the extension directory.
For example i have tried :
var heroPage = "";
$.get('/hero.php', function(data) {
heroPage = data;
});
var townPage = "";
$.get('/town.php', function(data) {
townPage = data;
});
And then i try to use the data in the mouseover listener, and the first one works every second time, but the second does not work at all...it may be something with some limitations or etc.
Is there a way to use for example php file with requests in chrome extensions (in the extension directory), or use some kind of different requests or in the different way ?
I need to get at least 5 requests on page load or even near it and store some data in local-storage or etc., and just cant make it work...
Thank you for you help ! answer will be selected for those who is helping for points ;)
Basically what i need is to fetch infromation from webpage html and store it in local-storage but to fetch from few pages at almost same time. ?
Answer to one of the answer and maybe more clear explanation :
Hey thanks for answer but it was not what i meant, maybe i did not explained it clearly. What i meant is : I am having a problem with the link you send with http request (because i am doing like so now) that it works only with one request per some time or etc. and i need to fetch html from five pages. The second thing i understand that php needs to be on the server with apache and etc. i was jsut thinking about overcome to this problem, maybe if i would store php file on my server, and make one request to it, and that php file would make more http requests to where i need and it will returnev erything in one data to the js file. I just need a way get five www html websites into variables on my extension at almost same time , what is the better way to do it ?
someone ?\?
First, let's clear up a thing or two. Files fetched from the World Wide Web are fetched from a server that's usually running Apache with a bunch of add-ons for stuff like executing PHP. The environment that your Chrome extension code runs in isn't any of that, so PHP won't run; it'll just get treated like any other text in the file. The only things that make your extension different from a plain HTML file loaded from the file:// protocol are the manifest.json file and some special privileges.
Now on to your question. It's not very clear, but it sounds like you were trying to use PHP to get around the fact that browsers won't let you directly fetch a file on another domain with Ajax. But Chrome will in fact allow a Chrome extension to do this, if it requests this permission. Head to the Cross-Origin XMLHTTPRequest page and scroll down to "Requesting cross-origin permissions" for more information.
When I look at Amazon.com and I see their URL for pages, it does not have .htm, .html or .php at the end of the URL.
It is like:
http://www.amazon.com/books-used-books-textbooks/b/ref=topnav_storetab_b?ie=UTF8&node=283155
Why and how? What kind of extension is that?
Your browser doesn't care about the extension of the file, only the content type that the server reports. (Well, unless you use IE because at Microsoft they think they know more about what you're serving up than you do). If your server reports that the content being served up is Content-Type: text/html, then your browser is supposed to treat it like it's HTML no matter what the file name is.
Typically, it's implemented using a URL rewriting scheme of some description. The basic notion is that the web should be moving to addressing resources with proper URIs, not classic old URLs which leak implementation detail, and which are vulnerable to future changes as a result.
A thorough discussion of the topic can be found in Tim Berners-Lee's article Cool URIs Don't Change, which argues in favour of reducing the irrelevant cruft in URIs as a means of helping to avoid the problems that occur when implementations do change, and when resources do move to a different URL. The article itself contains good general advice on planning out a URI scheme, and is well worth a read.
More specifically than most of these answers:
Web content doesn't use the file extension to determine what kind of file is being served (unless you're Internet Explorer). Instead, they use the Content-type HTTP header, which is sent down the wire before the content of the image, HTML page, download, or whatever. For example:
Content-type: text/html
denotes that the page you are viewing should be interpreted as HTML, and
Content-type: image/png
denotes that the page is a PNG image.
Web servers often use the file extension if the file is served directly from disk to determine what Content-type to assign, but web applications can also generate pages with any Content-type they like in response to a request. No matter the filename's structure or extension, so long as the actual content of the page matches with the declared Content-type, the data renders as intended.
For websites that use Apache, they are probably using mod_rewrite that enables them to rewrite URLS (and make them more user and SEO friendly)
You can read more here http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
and here http://www.sitepoint.com/article/apache-mod_rewrite-examples/
EDIT: There are rewriting modules for IIS as well.
Traditionally the file extension represents the file that is being served.
For example
http://someserver/somepath/image.jpg
Later that same approach was used to allow a script process the parameter
http://somerverser/somepath/script.php?param=1234&other=7890
In this case the file was a php script that process the "request" and presented a dinamically created file.
Nowadays, the applications are much more complex than that ( namely amazon that you metioned )
Then there is no a single script that handles the request ( but a much more complex app wit several files/methods/functions/object etc ) , and the url is more like the entry point for a web application ( it may have an script behind but that another thing ) so now web apps like amazon, and yes stackoverflow don't show an file in the URL but anything comming is processed by the app in the server side.
websites urls without file extension?
Here I questions represents the webapp and 322747 the parameter
I hope this little explanation helps you to understand better all the other answers.
Well how about a having an index.html file in the directory and then you type the path into the browser? I see that my Firefox and IE7 both put the trailing slash in automatically, I don't have to type it. This is more suited to people like me that do not think every single url on earth should invoke php, perl, cgi and 10,000 other applications just in order to sent a few kilobytes of data.
A lot of people are using an more "RESTful" type architecture... or at least, REST-looking URLs.
This site (StackOverflow) dosn't show a file extension... it's using ASP.NET MVC.
Depending on the settings of your server you can use (or not) any extension you want. You could even set extensions to be ".JamesRocks" but it won't be very helpful :)
Anyways just in case you're new to web programming all that gibberish on the end there are arguments to a GET operation, and not the page's extension.
A number of posts have mentioned this, and I'll weigh in. It absolutely is a URL rewriting system, and a number of platforms have ways to implement this.
I've worked for a few larger ecommerce sites, and it is now a very important part of the web presence, and offers a number of advantages.
I would recommend taking the technology you want to work with, and researching samples of the URL rewriting mechanism for that platform. For .NET, for example, there google 'asp.net url rewriting' or use an add-on framework like MVC, which does this functionality out of the box.
In Django (a web application framework for python), you design the URLs yourself, independent of any file name, or even any path on the server for that matter.
You just say something like "I want /news/<number>/ urls to be handled by this function"