Jump to content
Larry Ullman's Book Forums


  • Posts

  • Joined

  • Last visited

electrum's Achievements


Newbie (1/14)



  1. I can get the tooltips to work fine in ie9 , firefox 6.0.2 and chrome 13.07... just select one of the two options (polyps or strongs) with the radio buttons and hover over the added markup. If you dont see the radio buttons, then your browser doesnt support ajax. The site is not an application-based web tool, more just a personal record of bible studies etc.. the tooltips will be helpful for me, and the tooltip data shouldnt change,.. at least it hasn't since it was written in the latter half of the 19th century. But yes you're right. having a fallback in case the ajax isn't supported is a very good idea. I have a second free domain I can easily redirect to in case javascript or ajax is not supported. It looks like being a busy time going back to those scripts. The bible verses were sourced from xml files and the dictionary definitions from a tricky combination of csv files, sqlite databases and the odd correction cut and pasted from the web,.. but I should be able to patch it together differently with a script like you suggest. Once I have such an admin script together I will not have too much trouble, there are very few problems that there aren't solutions for re: the css styling of tooltips. Ive already seen a few answers. This post originally started as a request for help with cross browser support for localStorage / cookies to help me remember the history of tooltips I had singled out by "pinning them" with a click rather than a hover. It would be nice for client side storage to be accessible through the same methods, whether localStorage or cookies are used. I am working my way through putting together some functions with a CookieWrapper class, but I have a few problems as I'm no javascript programmer. thanks for the help, I would like to continue to concentrate on the javascript before I forget all the stuff Im doing! What could I do if neither cookies or localStorage are enabled? I'm guessing I could make a server side session database with php, the ajax would certainly facilitate that. It has been a while since I visited sessions but I would require the history to be there on my next visit... So either the history is available to everyone or I have to make a log in page which I was hoping to avoid doing . It's daft to think I have to log in to my own site when almost no-one else visits it! Alex
  2. Hiya,.. Its sure a workable idea. There are a couple of similar ideas ive seen elsewhere, an anchor had a nested span initially set to display: none. Ill have to look for it again. then, the anchor had its hover attribute fiddled to display the(empty) span, and the title attribute of that span then appeared as a tooltip. (i think - it was a while ago) I might go back to look for it. It did invole three or fourl different style settings. On the other side, I have a small test page, here I would like to be able to test it on a slower connection, but see what you think. If it isnt broken and all that... I'll have to go back to my xml files and fiddle with some more php to combine all of the dictionary database with my markup generating script. Sounds a nasty job, There are 31102 verses in the bible and some 14000 different original language words, so Ill have to write a script to combine them before I add them to the page, but Ill save myself some webspace and keep the databases as they are and put the work in a script. It will drive me nuts Im sure !! Always good to have a fallback. Thanks. Alex. Ps. If you look at that test page, each ajax request is made with a sepeate call to ajax.open("get","http.....) would i see a performance increase by using a single ajax open call with "post" and calling send more than once? - I could use it with setTimeout and clearTimeout so if its left inactive, a call to abort, then another call to open() as required would be used. Ideas?
  3. Hi there, I just tried to see if I could make a title attribute modified with an <h1> tag, but... <p>some text has a <span title="<h1>just an h1 tag</h1>">title</span> with an html content.</p> the tooltip simply shows "<h1>just an h1 tag</h1>" when hovering over the word "title" in the span. If the title attribute cant be styled by even having its own classname upon a tag, such as div or span, within the quotes... how would it work for me? Oh, and by the wrapper, I would like to be able to have the same methods for local storage upon the cookies, so I could do something like this... var myStorage = window.localStorage || new cookieWrapper(); then use myStorage.setItem("name",value); and other localStorage methods on top of cookies if localStorage is not supported. Alex
  4. Hi again, Wouldnt parsing the whole document for the keys, performing a very disjointed set of "select" queries, parsing it into json and back, and then writing it into the right elements in the right order be a terror of a p vs np problem? I didnt store the reference key in my verses as the auto_increment primary key id. They are referenced by strongs number (a kind of alphabetical order) This allows easy linking of the word origins between different entries. Reparsing the whole database is an option... but arrrgh! My approach is to use tooltips that i could style with css, I have not found this online anywhere else. I have it all up and running with one ajax object, and it seems fine in my test page. My approach is to have the radio buttons, a link to (currently three) scripts ajax.js .. sprytooltip.js and my "childfill.js" (the event handlers etc) and just one div tag at the foot of the page for the tooltip content. This is great for me because I use dwt templates in dreamweaver and it helps me keep the code tidy and easy to follow. Edit - I am altering an existing html site on a www.domain.com address, my cgi server is reachable at "cgi.domain.com" - I have tested ok that I can relax the documents domain property from www.domain.com to just ".domain.com" to let me use ajax without the same origin restrictions,.. but I would still like the site to be on the "www.domain.com" address. My hosting space is shared between the servers, so there is no real size restriction, (but I am not building a new site, just trying to add a little more functionality to an existing one.) I would really prefer not to re-write the whole site as a php driven entity! I'm sorry, should have said so before. Are there any benchmarks comparing asynchronus ajax requests with normal html over http? If I have a site that can happily stream cd quality audio @ 192kbps how would my ajax request compare? (I can easily max out my 8Mb connection) I have had a quick search, no luck yet. After a few months (way back) of bloated MFC classes, there is a certain amount of plaster on my legs I learned to find bearable Anyway, things are about as compact as I can get them source-wise so far, any ideas on the wrapper for cookies? Alex
  5. Hi Larry, The speed is not a problem, in fact its faster on the isp's server than on my own PC,.. the looping back though localhost in my host file adds a considerable lag on my pc with xammp. My isp stopped offering hosting some 5 years back and only provide it for customers who already had it before then, so its really zippy, and they recently upgraded their cgi too. The actual tooltips themselves would be tricky to implement without ajax,.. they would require a redirect to another page for sure... They have several parts, the reference key, the original words in greek or hebrew (needs unicode) the word usage, origin, transliteration into english and the word's phonetic pronounciation as well as the dictionary definition. The data is not so long that it requires a long query with joins etc.. its a select query on the reference key as a unique index and its probably too tricky to fit into a title attribute, but not too large as to be slow and unwieldy. in size its comparable to the examples in the ajax quickproject book. Choosing the "no markup" radio button makes the mouseovers redundant.. so it needn't slow down anyones session if it comes to that, 'user beware' I guess! There isn't exactly any reason for the server to have access to the information i want to store, even with the history records. I can simply script a small iframe to display the relevant links on the fly. All I would need to store is say a php style imploded array seperated by a pipe character or somesuch. For this reason I'd prefer to avoid cookies.. but If you could provide any help for a wrapper to implement an API over cookies that would help me mimic the localStorage functions I would need, that would be invaluable. I just have huge problems understanding what all this prototype nonsense is about! Sheesh, wouldn't I kill for C++ style classes! Thanks for the swift reply... Alex
  6. Hi there! I posted a question on the php6/Mysql forum a while back about making popup tooltips with content filled through a mysql database connection. I was pointed towards the ajax quick project book, and as near as can be.. it is almost ready for uploading to my isp's server. The project is to allow the user access to live popup tooltips over bible scripture containing the original greek/hebrew definitons from the Mysql database. The connection is through ajax. I have a couple of enduring small problems... I have a small form with three radio buttons linked to onchange handlers in the window.onload = init; function. They allow the selection of no markup, single character markup and dictionary subject_key superscript markup within the text on the page. It is this markup that acts as the triggers for the popup tooltips. All I would like to be able to put together now is some kind of client side storage of the state of the users choice for the appearance of the markup (the radio buttons) . Enduring beyond the user's current session is preferable,.. but across tabs desirable and between pages in the browsing "lane" is essential. I have ruled out sessionStorage for this, and MS userData wouldnt work either as I would browse across folders. - Help? The radio buttons appear on the page if ajax is supported. Can you help me with some advice and / or assistance on putting together something that will work on most browsers? I can happily rule out any that do not support ajax through XMLHttpRequest or ActiveX. After that, I would like to be able to keep a clientside stored history list of popup's visited, but only through an onclick event, not the mouseover/mouseout. This can wait,.. but initial help with things stored client side would help a great deal! Thanks for any help you can offer - I am finding javascript very confusing, (I much prefer ansi C) I know its a little off topic ajax wise, but it is a web site using ajax,.. and i could really use the help Alex
  7. Hi again, Thamks Paul, I might go for that if I cant get the definitions to work in 'ccs styled' table form within the popup. I have reserved a copy of Larry's ajax book from my county library, I should have it within a couple of days. I found I can do exactly what I would've liked by using <iframe src="http://.../scripts/lexicon.php?id=1234"></iframe> within Dreamweavers tooltip balloons. (And style with css) Unfortuneately, <iframe> looks as if it is on its way out. Still, I am always up for a challenge, and the ajax idea is certainly more future-proof than using frames. Since I will have had to learn a little javascript to fiddle with the tooltip script (so I don't have to repeat the iframe tags everywhere), I may as well settle down and make sure things are done to last, and learn something useful too. (I cant even remember the last time I visited a site with frames) Thanks!
  8. Hi there, I will seriously think about purchasing Larry's ajax book! I was hoping to be able to use php for querying the databases.. Each section of text (bible verse) will need to be pre-formatted with references (<span id=...>) for each word, to the particular definition of the original greek, from the database. These id's will be pre-generated and left in the page's html content (from an admin script). The particular tooltips would be better generated on the fly, with the content formatted by php - (being the bulk of the data) querying the lexicon databases with the particular word's id. I think perhaps the alternate purpose of phpbible.org's script, as a concordance for searching the text for a particular english word is better suited to Larry's comment. (though if you click on a word in a displayed verse you will get a new window with the lexicon definition - that is what I would like to implement as a tooltip) I considered using php to build all the pages and tooltips from scratch before the page finishes loading using dreamweavers tooltip widget, however as the tooltip content would need to be in place from the server already, rather than at the moment the particular word (in whatever verse) was hovered over - fully prepared content would really bulk things up. Each tooltip would need many definitions, rather than just one and a function call / get method. (I was hoping to simply use a specific GET method with the lexicon id) As there could be a couple of hundred such words on the page all requiring different tooltips (dictionary def'ns), I would much prefer using the "magic" to keep the source short. Opening in a seperate window would speed things up, but using a popup balloon without the need to reload the page or open/close windows etc is my goal. (Otherwise I may just use the original phpbible script) I managed to get a book out of the library on javascript - I will certainly look to see about using php asynchronously. (I think I've chosen far too thick a book on the subject, (and probably far too technical) so I will certainly keep an eye out for Larry's book!) Thanks again!
  9. Hi there, I have just finished going through the examples in the book. I really enjoyed working through it! I was particularly interested in the final example, when the view_print page is sent an image through the header() function from the show_image script. Is there any way to send inline html content within the header function? I am unsure of how to do this. I picked up your marvellous book because my ISP provides a basic MySQL service. My hope is to use dreamweaver's built in popup balloons / mouseovers to show the dictionary definitions within a Mysql database applied to textual elements within web pages. it would be easy enough to span each word with a seperate id, but Id prefer to insert the balloon text from a php script on my isp's cgi server. (Having limited space there) Such areas crop up all over my site, where I would love to have the definitions pop up, but can't as yet. I already have access to the database files, but I will trim them down a bit and probably format them to suit the task (once I have a method!!) I was hoping to use dreamweavers built in "spry tooltip" As far as I can tell (I know no javascript) it provides a text area with which to fill the 'tooltip' and can be styled with css. So, is there a wonderful "text" alternative for the <img src=".." /> tag? How would I write the header() functions? I would attempt to pass the db id parameters with a get method as in your example. I managed to find the databases through phpBible.org (Strong's lexicons) They have a similar thing up and running with a click-to-appear window. Whilst simply adding this to my site would be easy enough, I would much rather the mouseovers. Of course, no effort means little challenge! And I would customise the content and layout of the output.. A good first project for me. Were it only a few words here and there, I would hard code it in or put the whole set of pages on the cgi server.. That's still an option, But I would like to give this a try if it can be done. I would greatly appreciate your help!
  10. Thank you! The $_SERVER['REQUEST_URI'] seems to be just the ticket! thank you! - looks like it will solve the referring domain trouble too.
  11. Hi again, I managed a rather bodge job of fixing this... simply used str_ireplace to remove '~usrname/' from the path and replace it with an empty string. I would prefer to find some way that would keep this script as universal as possible. Any ideas? Thanks.
  12. Hi there, I am really enjoying the book, but I have been having trouble with the login_functions.inc.php script in chapter 11. This is not due to an error in the code, or typeing errors, the script runs fine and does exactly what it is supposed to do. My problem is I cannot use the function myself because of the way my cgi server is set up with my domain name by my ISP. when concatenating the parts of the URL together in the absolute_url() function, with the variables $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); The parts of these variables add up to "http://" . "cgi.usrname.host.com" . "~usrname/folder1/folder2/loggedin.php" The trouble is the path to the loggedin.php script is actually "http://cgi.usrname.host.com/folder1/folder2/loggedin.php" Its also compounded by the trouble that I host under a domain name, so "http://cgi.mydomain.com/folder1/folder2/loggedin.php" is completely inaccessible. by the header function redirect. (cgi.mydomain.com masks for the cgi.usrname.host.com address) It took me a while to discover this, because the server will automatically search for the nearest index.php script. The page will redirect to index.php for some reason. and list as "http://cgi.usrname.host.com/~usrname/folder1/folder2/index.php" Trying to access any other page with that directory structure gives the standard page inaccessible error The cookies are accepted and login occurs with the correct welcome message, (my first name) when the address is typed in properly (in the same session). (Either "http://cgi.usrname.host.com/folder1/folder2/loggedin.php" or its equivalent "http://cgi.mydomain.com/folder1/folder2/loggedin.php") Is there a fix for this to allow me to be able to use a function like this easily as I would wish? -preferably with equal applicability) I would be most grateful for any help, thank you!
  • Create New...