Jump to content
Larry Ullman's Book Forums

Cofa

Members
  • Posts

    54
  • Joined

  • Last visited

Everything posted by Cofa

  1. Thanks again Hartley San. I have decided to avoid the complicated regular express approach. For purposes of sharing with the forum, my solution to allow user to add links in their message (an ad page), is to have them fill in up to 9 sets of input fields. Each set consists of one "caption" field and one "full url" field. When the page is loaded, those links (if any) will be listed at the bottom, apart from the message block (each link is rendered by combining a caption and a full url in pair). It's not fancy at all but should serve the needs of most users of our services.
  2. Sorry it looks like I am making things complicated. To make it easier to understand what I wish to do I am rewording my question again: Say if I send an email message to introduce a website to my friend. I would simply type (or copy and paste) the URL in text: "Visit this site to find out: www.sitename.com." When the message is received in the reader's browser, the URL will become a "clickable link" - this feature is seen in Gmail and many email services. And this is what I try to accomplish with my site: User can type any number of URLs in the textarea input area (I assume they know very little HTML tags), and when the message (eg, advertising) is published on a webpage, the URLs in the message will be converted into active links. Thanks for your comments. After some research I agree that it is not an easy job for me. I might just leave the URLs in plain text form for now then.
  3. Hi HartleySan, thanks for your response. What I mean is that the entry will be stored to database using this code: $message = mysql_real_escape_string(htmlspecialchars(trim($_POST['message']))); When the entry is retrieved from database I use this code to print the message on the webpage: echo nl2br($row['message']); The effect is that all HTML tags (if any) will be printed in text strings. For example, the <a href...> tag will become <a href...> and the anchor tag will have no effect as a clickable link. But the goal of my question is to see how I could change a simple URL text string (no HTML tag) a user has entered in the textarea can be printed as an active link on the webpage, using PHP coding. I think I might be able to do one URL in the message using strstr() but I would not know how to do it if there is more than one URL in the message.
  4. I have a textarea in a form to collect user message to a database. When the entry is stored to database all html tags are converted into text. Users can include any number of URLs in the message. With my current settings all the URLs will be printed on the webpage as static character strings (i.e., they are not "clickable."). I wonder how I could make those URLs become clickable links when the message is retrieved from database and printed on a webpage, using purely PHP coding?
  5. Anyone who is familiar with the topic "MLS® data feed" and all of the components in the subject line? I want to develop a program that can fetch MLS listing data from the appropriate MLS data servers in Canada and in the US for use by multiple user. My initial research shows that none of the "data feed" sources and specifications have anything to do with PHP and MySQL. Could anyone give me an idea how big the difference is between the specifications of RETS, IDX, DDF, XML and the specifications of PHP and MySQL? Thanks.
  6. Thanks HartleySan. I notice that (as from real test), the SELECT `AUTO_INCREMENT` code will get the *future* ID to be inserted if I subsequently execute an insert query. I assume there would be a chance my actual insert would generate a member_id that's different than the value being captured in the first query, IF there's another transaction that has been executed in between my two queries - is this possible (although extremely slim)? Anyway, I found your second suggestion much easier for me, and with these advantages: 1) Everything is inserted in just one query (i.e., only the lastname and firstname values), and the "auto_increment ID" is guaranteed to be unique for that query. 2) The publicname value can be generated by SELECT whenever is needed, and can be in any pattern (good flexibility for future changes). Thanks again!
  7. I have a membership table which contains the following fields (as example): member_id (primary key, auto increment = 123) lastname (= Smith) firstname (= David) publicname (= 123SD) Note that the value of the field publicname is in fact the combination of the member_id and the first characters of the fields lastname and firstname, respectively. I manage to insert the values of the first three fields to create a new record as the first step, then create the value for field publicname and insert it into the newly created record as the second step. My question is, whether it is possible to insert a new record in just ONE sql query: two values for fields firstname and lastname are provided via form input while values for fields member_id and publicname are generated by a php script. If it is possible, any hint how this could be achieved? Thanks!
  8. Mmmm. Each combination of m_id and other columns can be a unique record (listing). If we don't have l_id (listing id), how could we call (identify) a record from the table then? I must miss something here and am interested in knowing more. Thanks.
  9. Hi HartleySan, thanks for your comments. The l_id in the listings table is the primary key (auto assigned and auto incremented whenever a new listing is created). In the listings table each record will have many more other columns (property age, price, room measurements, etc, etc) that are not shown here. For my learning sake, I don't understand why you see m_id in the listings table could be unique, as each member ('m_id') can have many unique listings in the table (only the 'l_id' is unique). Thanks.
  10. Below is my final result of this topic - four tables and two query options... members m_id m_name 1 David 2 Jennifer 3 Mary groups g_id g_name 1 Group1 2 Group2 mem_group m_id g_id 1 1 2 2 3 1 3 2 listings l_id m_id type 1 1 House 2 3 Condo 3 1 Condo 4 1 Townhouse 5 3 Condo 6 2 Condo 7 3 Condo ----------------------- SUCCESSFUL QUERY CODE: ----------------------- SELECT l.* FROM listings AS l LEFT JOIN members AS m ON l.m_id = m.m_id LEFT JOIN mem_group AS mg ON m.m_id = mg.m_id WHERE mg.g_id = 2 ORDER BY l.l_id DESC ----------------------- SELECT * FROM mem_group AS mg LEFT JOIN listings AS l ON mg.m_id = l.m_id WHERE mg.g_id = 2 ORDER BY l.l_id DESC
  11. Thanks for following up on this. I'll check out the query code when have chance and update here again. Have a great day!
  12. After some thinking, I still don't understand why the need of "another table between members and listings," since I already have table listings consisting of this relationship. Any hint please? (Note: the table listings will also consist of other columns like property_type, address, age, etc.) I still haven't had a chance to experiment the query as I have not built the tables yet. But I have yet already had another query code (below) - wonder if there is any error. Thanks. SELECT m.id, g.id FROM members AS m, groups AS g WHERE g.id = 2 ##We are to get all listings of group 2 GROUP BY g.id LEFT JOIN members_groups AS mg ON ( g.id = mg.group_id ) LEFT JOIN listings AS l ON ( l.member_id = m.id ) ORDER BY l.id DESC
  13. Thanks again for the quick reply! I think I'll need some time to figure out how to do the query part.It's good to know the direction so far. Have a great day!
  14. Thanks HartleySan for the quick reply (and how are you? it's been a while ) ! I have not set up the database tables yet but figure that what I need to do next could be as follows... I'll set up a listings table and use the SQL query to retrieve the listings of a specified group, like this: listings id member_id 1 1 2 3 3 1 4 1 5 3 6 2 SELECT l.*, m.id, g.id, mg.group_id FROM listings l, members m, groups g, members_groups mg WHERE g.id = '2' ##We are to get all listings of group 2 AND mg.group_id = g.id AND l.member_id = mg.member_id GROUP BY l.id ORDER BY l.id DESC; Could you predict any wrong in the above code? Thanks!
  15. Hello all, I have been wondering if this is even possible: Say, a) I have a database containing real estate licensees ("members") and their real estate listings; members can form groups and each group will have a unique group name ("team1", "team2", etc); c) listings of a members that are linked to a particular group name of that member can be displayed in the website of other members of the group (e.g., listings that are linked to the group name "team1" of all members of the group can be retrieved by any member in the group using the "team1" group name); and d) I store the group names in the column "group_name" in table "members". Now my problem is, say if a member belongs to two groups ("team1", "team8"), 1) can I store both "team1" and "team8" in the "group_name" field under that member? 2) how could his listings be retrieved and displayed in different group members' sites by either of these group names? My goal is to allow members to have more than one group name, and his /her listings will be retrieved by different group members quoting the appropriate group names. How could I achieve this? Thanks, Cofa
  16. Hello HartleySan, (and those who might be interested) I found the Javascript from this page likely to be able to achieve what I wanted: http://www.quirksmode.org/js/popup.html I have modified the code from the above page a bit, and the result seems to be close to what I want. Here are two files containing my modified code... 1) PARENT PAGE HTML CODE: --------------------------------------------- <!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body style="margin:0; padding:0; background-color:transparent;"> <div style="margin:36px; padding:18px; background-color:#eee;"> Image below is in iFrame:<br> <iframe style="width:300px; height:250px; background-color:transparent;" name=inline src="00-h5banner3in.html" frameBorder=0 scrolling=no allowtransparency="true"> </iframe> </div> </body> </html> 2) BANNER FILE HTML CODE: File name = "00-h5banner3in.html" --------------------------------------------- In the code below, changing the "target option" (on line 11) in the Javascript in the HEAD tags will control the target window of the link in the BUTTON of the page: <!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script type="text/javascript"> <!-- //NEWWINDOW TARGET OPTIONS: '_self'; '_top'; '_parent'; '_blank'; 'namedWindow'; function windowTARGET(url) { newwindow=window.open(url,'_top'); if (window.focus) {newwindow.focus()} return false; } // --> </script> </head> <body style="margin:0; padding:0; background-color:#ccbbcc;"> <input type="button" value="Open window" onclick="return windowTARGET('http://www.homesmarketing.com/')"> </body> </html> As you can see, though, the above example uses a BUTTON to open a target link to demonstrate the use of the Javascript. If the INPUT-BUTTON link is replaced with a third-party banner ad (Flash or H5 banner), the Javascript function above will not work unless the function "windowTARGET" is incorporated in the banner ad. Any comments please? Thanks. (Edit 130728)
  17. thanks Hartleysan, i did thought that a js code could achieve my goal but didn't expect that complicated. yes, using the banners the way they were designed seems to be the only way for my site for now. and again, thanks for trying to help!
  18. Hi HartleySan, That is too complicated for me - I simply am not at that grade yet. But again, thank you for looking into the question and trying to help. I really appreciate it!
  19. Hi HartleySan, The plain text (html) files are in my #9 message - I now repeat them below with their code in the quotes, for your easy reference: See samples modified from your files: PAGE HOLDING THE IFRAME: http://www.cofatsui.com/h5/00-h5banner-c.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>iframe demo</title> </head> <body style="margin:0; padding:0; background-color:transparent;"> <iframe style="width:300px; height:250px; background-color:transparent;" name=inline src="/h5/testa09/testa-c.html" frameBorder=0 scrolling=no allowtransparency="true"> </body> </html> BANNER FILE ON ITS OWN: http://www.cofatsui.com/h5/testa09/testa-c.html This "testa-c.html" banner file can be submitted from third party and will be inserted in the iFrame in the above parent page. As you can see from the below, I cannot use the anchor and target="_blank" method suggested by you. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Page loaded in iframe</title> </head> <body> <!--ORIGINAL CONTENTS <a href="http://www.google.com" target="_blank">Google (new window)</a> --> <script type="text/javascript"> var tweenui_cid = "c5a17c7d-55f7-4f29-bfa1-e9e506da71af"; var tweenui_pid = "5234ffa3-dfbd-4270-b161-83342b8d7e3a"; var tweenui_width = 300; var tweenui_height = 250; </script> <noscript>Activate javascript to view TweenUI <a href="http://tweenui.com">mobile banner creator</a> content.</noscript> <script type="text/javascript" src="http://display.tweenui.com/show.js"></script> </body> </html> Please let me know if the above is what you want me to do or if I have missed anything. Thanks.
  20. Hi HartleySan, With your new message, I think I might understand what you mean. But then the problem is on my part: I know what to do up to the iframe part; but I have no knowledge to do with the JS part in the banner ("after that JS executes, there will be..."). Looks like a client side JavaScript is more complicated than I thought so I may just let those banners open the windows the way they were designed. Anyway, thanks for looking into my question.
  21. Thanks HartleySan, I am sorry but I am not sure if the "grab the contents of an iframe" approach could achieve my goal - My thinking is that in the case of a Flash banner or an H5 banner, there is a JS file built-in and it is this JS file that would control the opening of the target window, not the contents of the iframe. Contents of the iframe: <iframe style="width:300px; height:250px; background-color:transparent;" name=inline src="/h5/testa09/testa-c.html" frameBorder=0 scrolling=no allowtransparency="true"> Contents of the H5 banner "/testa-c.html" in the above iframe: <script type="text/javascript"> var tweenui_cid = "c5a17c7d-55f7-4f29-bfa1-e9e506da71af"; var tweenui_pid = "5234ffa3-dfbd-4270-b161-83342b8d7e3a"; var tweenui_width = 300; var tweenui_height = 250; </script> <noscript>Activate javascript to view TweenUI <a href="http://tweenui.com">mobile banner creator</a> content.</noscript> <script type="text/javascript" src="http://display.tweenui.com/show.js"></script> As a matter of fact, we can code however we could the iframe contents, but we have no control of the banner file submitted by third party (e.g., the "/show.js" file in the banner). I believe we need to have a client-side script that could override the setting of the JS ("/show.js") in the banner, if that is really achieveable. Thanks.
  22. Thanks HartleySan, but no that's not what I am looking for. The part in your example b.html: [A TAG]Google (this window)[A TAG END] or the code between the BODY tags, is that I have no control of if the banner file is from a third party (same for your "c.html"). If you refer back to message #5, code for the URL "/testa09.html" you'll see that the contents between the BODY tags are the code that will deliver the h5 banner or Flash banner, which also controls how the target link will be opened. In other word, if you replace the code [A TAG]Google (new window)[A TAG END] in your file c.html with the following code (seen in my code in message #5): <script type="text/javascript"> var tweenui_cid = "c5a17c7d-55f7-4f29-bfa1-e9e506da71af"; var tweenui_pid = "5234ffa3-dfbd-4270-b161-83342b8d7e3a"; var tweenui_width = 300; var tweenui_height = 250; </script> <noscript>Activate javascript to view TweenUI <a href="http://tweenui.com">mobile banner creator</a> content.</noscript> <script type="text/javascript" src="http://display.tweenui.com/show.js"></script> you'll have no control how the target link in the banner would open. See samples modified from your files: PAGE HOLDING THE IFRAME: http://www.cofatsui.com/h5/00-h5banner-c.html BANNER FILE ON ITS OWN: http://www.cofatsui.com/h5/testa09/testa-c.html And what I am looking for is a JavaScript (if this is possible) that could force the banner in the iFrame to open in a specific window that the JavaScript dictates. Thanks.
  23. Hi HartleySan, It is because I plan to go with the new trend of using html5 banners on my site, which will ultimately avoid using Flash or other forms of media for the banner ads. With h5 banners, one of the vision I see is that at some point advertisers will be able to modify the contents of their banners from a web-based interface any time they need (just like today's modifying an html ad page via form submission). Since we will take h5 banners from third parties, I think that it would be nice to have a control to force how a target webpage would open - I still wonder if this can be achieved and how. Thanks!
  24. Hello HartleySan, Thanks for the stackoverflow link - I found that link and tried that before, but it didn't work... The banners are all stored in the same folder where the file of the parent page and the file in the iFrame are stored as well, as you can see from this: www.cofatsui.com/h5/00-h5banner2.php <!doctype html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> <head> <meta charset="utf-8"> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> /** NO STYLE RULE DEFINED HERE **/ </style> </head> <body style="margin:0; padding:0; background-color:transparent;"> <?php $input = array("03", "10", "00", "09"); $rand_keys = array_rand($input, 2); $testadid = $input[$rand_keys[1]]; ?> <iframe style="width:300px; height:250px; background-color:transparent;" name=inline src="http://www.cofatsui.com/h5/testa<?php echo $testadid; ?>/testa<?php echo $testadid; ?>.html" frameBorder=0 scrolling=no allowtransparency="true"> </iframe> </body> </html> As you can see from the above, one banner is being selected randomly and served from the iFrame. The following is a link of the "00" banner - The banner will still open the target page in a NEW window, even though I have put the <base target="_parent"> in the file: http://www.cofatsui.com/h5/testa00/testa00.html <!doctype html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> <head> <base target="_parent"> <meta charset="utf-8"> <title>HOMES marketing html5 banners html5 css3 html5 banner ads real estate listing services</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="Keywords" content="HOMES marketing html5 banners html5 css3 html5 banner ads real estate listing services"> <meta name="Description" content="HOMES marketing html5 banners html5 css3 html5 banner ads real estate listing services"> <style> /** NO STYLE RULE DEFINED HERE **/ </style> </head> <body style="margin:0; padding:0; background:0;"> <canvas id="testa00" onclick="this.focus();" oncontextmenu="return false;" width=300 height=250 style="outline: none"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="250" id="testa00"> <param name="movie" value="testa00.swf" /> <param name="quality" value="high" /> <param name=allowscriptaccess VALUE="always"> <!--[if !IE]>--> <object data="testa00.swf" type="application/x-shockwave-flash" width="300" height="250"> <param name=allowscriptaccess VALUE="always"> <param name="quality" value="high" /> <!--<![endif]--> <a href="http://www.adobe.com/go/getflash"> <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/> </a> <!--[if !IE]>--> </object> <!--<![endif]--> </object> </canvas> <script type="text/javascript" src="testa00.js"> </script> </body> </html> The following is from the "09" banner - The banner itself was set to open in the PARENT window. And as you can see, even when I put the <base target="_blank"> in the file, it will still open the target page in the PARENT window: http://www.cofatsui.com/h5/testa09/testa09.html <!-- saved from url=(0013)about:internet --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <base target="_blank"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>fs_aux</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> </head> <body> <script type="text/javascript"> var tweenui_cid = "c5a17c7d-55f7-4f29-bfa1-e9e506da71af"; var tweenui_pid = "5234ffa3-dfbd-4270-b161-83342b8d7e3a"; var tweenui_width = 300; var tweenui_height = 250; </script> <noscript>Activate javascript to view TweenUI <a href="http://tweenui.com">mobile banner creator</a> content.</noscript> <script type="text/javascript" src="http://display.tweenui.com/show.js"></script> </body> </html> I might have missed something that I don't know. Thanks.
×
×
  • Create New...