Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Coolguy

  • Rank

Previous Fields

  • Languages
    XHTML. CSS. SSI. JavaScript. PHP. XML. SQL.

Contact Methods

  • Website URL
  • ICQ
  • Yahoo

Profile Information

  • Location
    Denver CO USA
  • Interests
    Snowboarding. Wakeboarding. Snowmobiling. Rock Climbing. Drinking. Partying. Clubs. Girls. Playing Guitar. Playing XBox /w Friends. Working Out. Health & Nutrition. Sketch Art. etc...
  1. Look up php mail() function.You'll need to know how to create forms in html, validate form inputs in php (including email address validation checks using regular expressions), and send mail in php.Start reading through w3schools.com. What you're trying to do is neither simple or easy. That, and don't create multiple posts for the same topic. Ex.http://w3schools.invisionzone.com/index.php?showtopic=17361
  2. a. For this problem you would set a variable (ex num_of_links) to increment in the loop that generates the html code for each link. Ie. add a counter into the "foreach my $iter (@x_nodes)" this loop and return it after the loop endsb. My preference would be to set the width to be the same for all ebb_navigationElement then just calculate the rest of the width using the formula above. If you decide against the easy solution here is the code to loop through the link text lengthsJust copy and paste this whole section to a new doc to see the demonstration <html><head><title>JavaScript Function Test</title><script type="text/javascript">function count_links(){ var count = 1; var total = 0; do { var chars = document.getElementById("nav"+count).innerHTML.length; alert("Nav"+count+"= "+chars+"chars"); count++; total += chars; document.getElementById("test").innerHTML = total; } while (chars!="");}</script></head><body onload="count_links()"><a id="nav1">link 1</a><br /><a id="nav2">link has lots of chars 2</a><br /><a id="nav3">ln 3</a><br /><a id="nav4">link anchor 4</a><br /><a id="nav5">link 5</a><br /><a id="nav6">link 6</a><br /><a id="nav7">link 7</a><br /><br />Total Chars: <span id="test"></span></body></html> I have to admit... I scratched my head for a minute trying to figure this one out.One obvious limitation to this method I see is that fonts appear different widths in different browsers. This may still be do-able with a little research.c. It's worth a try. To keep links from stacking if the browser width changes I usually contain the links within a container div with a static height that is the same as the height of the links.<quote>I think we are hitting a quite interesting web development challenge here. Have you seen other sites with nested div horizontal navigation bars with relative widths in percentages? I have done some hours of googling and scanning web development sites, but I have not found any sites that implemented such a system.</quote>I haven't seen this used in navbars. Of course, I don't usually pay much attention to navigation on web sites. I also haven't ever used a CMS to create a site (aside from mwiki) so I'm not very familiar with how they collect info to generate pages. If you want to see a site that uses percentages to adjust to the browsers window size check out this page.http://www.newegg.com/Store/Category.aspx?...ame=Hard-DrivesDrag the window size to increase/decrease width and notice how the sale items adjust to compensate.But, also notice how there are only 3 items no matter the size. This is done by using 33% in the same way I suggested using Ex1 in my last reply.As far as the multi-level nested-div-navigation, I'm not clear what you're talking about. Do you mean generated three-tier hierarchical drop-down menus? I think I have seen this before but I don't have any specific examples and I've never seen anything like it in a CMS generated site.I'm not familiar with perl so reading the template code is like reading Chinese to me but I'll digest it a little to see what it does.As far as using JavaScript. I would encourage you to use it as little as possible. Always remember that JavaScript is client-side meaning that users could always turn it off. I suggest using server-side (PHP ASP). Most of these features can be duplicated or compensated for in another language.
  3. For question #2. Apparently in IE6 if your image uses a pallet greater than 256 colors then it will render transparency as opaque.Read this:http://www.pcmag.com/article2/0,2704,1645331,00.aspWhich also includes this all-in-one IE6 kludge.http://homepage.ntlworld.com/bobosola/index.htmHope that helps.
  4. Coolguy

    DW Batch S&R

    It could be done pretty easily. All you'd have to do is pick a root dir, load the directory structure into an array queue, and rebuild it in an output root.I was thinking about extending this little snippet to load the tags from an xml file (which would also automatically exit certain strings). Making it process multiple files is also a really good idea. When you originally posted this, I thought your intention was just to update old deprecated HTML to a current DTD compliant (X)HTML. For a static purpose such as removing deprecated code, having all of the settings statically coded would be very quick and efficient, but for on the fly changes like you describe, DW is obviously more flexible.
  5. Scrap it. You could find a snippet of code that does the exact thing and takes almost no space.Here's a vertical scrollerhttp://www.dynamicdrive.com/dynamicindex8/topscroll.htmHere's a horizontal scrollerhttp://www.dynamicdrive.com/dynamicindex8/scrollexample2.htmYou could tweak to increase the width and hide the scrollbarIf you search around you could probably find something better.
  6. The code that I post will appear drastically different from what you have posted. The reason for that is because I have gone through and cleaned out all the redundant (not necessary) pieces. Part of the reason there were so many extra CSS classes was because whoever originally wrote this didn't understand a few important fundamentals of CSS, namely inheritance and usage of multiple-classes.Ex. If you haveebb_navigationElement {position: relative;display: inline;float: left;z-index: 1;margin-left:-2px;border-right: #009286 2px solid;border-bottom: #009286 1px solid;}and...div.ebb_navigationElement {float: left;z-index: 1;margin-left:-2px;}div.ebb_navigationElement is interpreted the same as ebb_navigationElement because of these attributes (float z-index margin-left) are already set in ebb_navigationElement. Basically, this whole class is redundant, useless, and therefore... unnecessary.Another error I saw repeated many times isborder: #000000;The "border" attribute is a shorthand tag therefore it always requires:border: [width] [type] ;If you wanted to set the border color you need to use:border-color:#000000; This is the original code (99 lines) <html><head><style type="text/css">div.ebb_navigation div.ebb_navigationSpacer {float:left;width: 100%;height: 1px;border-bottom-color: #009286;border-bottom-width: 1px;border-bottom-style: solid}DIV.ebb_navigation DIV {BORDER-TOP: #000000; MARGIN-RIGHT: 0px}DIV.ebb_navigation DIV.ebb_navigationElement {DISPLAY: inline; MARGIN-LEFT: -2px}DIV.ebb_navigation DIV.ebb_navigationElement_selected {DISPLAY: inline; MARGIN-LEFT: -2px}DIV.ebb_navigationElement {BORDER-RIGHT: #000000 0px; Z-INDEX: 1; FLOAT: left; BORDER-LEFT: #000000 0px; POSITION: relative; BORDER-BOTTOM: #009286 1px solid}DIV.ebb_navigationElementFirst {BORDER-RIGHT: #000000 0px; Z-INDEX: 1; FLOAT: left; BORDER-LEFT: #000000 0px; POSITION: relative; BORDER-BOTTOM: #009286 1px solid}DIV.ebb_navigationElement_selected {BORDER-RIGHT: #009286 2px solid; FLOAT: left; BORDER-BOTTOM: #000000}DIV.ebb_navigationElementFirst_selected {BORDER-RIGHT: #009286 2px solid; FLOAT: left; BORDER-BOTTOM: #000000}DIV.ebb_navigationElement_selected {BORDER-LEFT: #009286 2px solid}DIV.ebb_navigationSpacer {DISPLAY: block}.ebb_navigation#div DIV.ebb_navigationSpacer {DISPLAY: block}DIV.ebb_navigation DIV.ebb_navigationSpacer {FLOAT: left; WIDTH: 100%; HEIGHT: 1px}DIV.ebb_navigation DIV.ebb_navigationElementInner {BORDER-RIGHT: #009286 2px solid}DIV.ebb_navigation DIV.ebb_navigationElementFirstInner {BORDER-RIGHT: #009286 2px solid}DIV.ebb_navigation DIV.ebb_navigationElementInner_selected {BORDER-RIGHT: #000000}DIV.ebb_navigation DIV.ebb_navigationElementFirstInner_selected {BORDER-RIGHT: #000000}DIV.ebb_navigation DIV.ebb_navigationElementInner_selected A {COLOR: #000000}DIV.ebb_navigation DIV.ebb_navigationElementFirstInner_selected A {COLOR: #000000}</style></head><body><div class="ebb_navigation"><div class="ebb_navigationElementFirst"><div class="ebb_navigationElementFirstInner"><a href="/wps/openworld/ebb/germany/html/de/you_want_to.html" class="ebb_navigationElement_link_self" onclick="ebb_selectNavigation(this, false)">Sie möchten</a></div></div><div class="ebb_navigationElement"><div class="ebb_navigationElementInner"><a href="/wps/openworld/ebb/germany/html/de/our_products.html" class="ebb_navigationElement_link_self" onclick="ebb_selectNavigation(this, false)">Unsere Produkte</a></div></div><div class="ebb_navigationElement"><div class="ebb_navigationElementInner"><a href="/wps/openworld/ebb/germany/html/de/our_approach.html" class="ebb_navigationElement_link_self" onclick="ebb_selectNavigation(this, false)">Unser Ansatz</a></div></div><div class="ebb_navigationElement"><div class="ebb_navigationElementInner"><a href="/wps/openworld/ebb/germany/html/de/email_your_question.html" class="ebb_navigationElement_link_self" onclick="ebb_selectNavigation(this, false)">Kontaktieren Sie uns</a></div></div><div class="ebb_navigationSpacer"><div></div></div></div></body></html> and here is the cleaned version (55 lines) <html><head><style type="text/css">.ebb_navigationElement {position: relative;display: inline;float: left;z-index: 1;margin-left:-2px;border-right: #009286 2px solid;border-bottom: #009286 1px solid;}.left_offset {margin-left:0px;}.ebb_navigationElement_selected {color: #000000;float: left;border-bottom: #000000;border-left: #009286 2px solid;}.ebb_navigationSpacer {float:left;width: 100%;height: 1px;display: block;border-bottom: 1px solid #009286; }</style></head><body> <div class="ebb_navigation"> <div class="ebb_navigationElement left_offset"> <a href="/wps/openworld/ebb/germany/html/de/you_want_to.html" class="ebb_navigationElement_link_self" onclick="ebb_selectNavigation(this, false)">Sie möchten</a> </div> <div class="ebb_navigationElement"> <a href="/wps/openworld/ebb/germany/html/de/our_products.html" class="ebb_navigationElement_link_self" onclick="ebb_selectNavigation(this, false)">Unsere Produkte</a> </div> <div class="ebb_navigationElement"> <a href="/wps/openworld/ebb/germany/html/de/our_approach.html" class="ebb_navigationElement_link_self" onclick="ebb_selectNavigation(this, false)">Unser Ansatz</a> </div> <div class="ebb_navigationElement"> <a href="/wps/openworld/ebb/germany/html/de/email_your_question.html" class="ebb_navigationElement_link_self" onclick="ebb_selectNavigation(this, false)">Kontaktieren Sie uns</a> </div> <div class="ebb_navigationSpacer"> </div> </div></body></html> Now... pertaining specifically to the issue you brought up. The reason the code you're trying to implement isn't working is because you're trying to mix fixed-widths with percentage widths. A browser isn't capable of anticipating that the width after the dynamically generated links, this is why when you set the spacer to width:100% the browser interpreted the width as 100% of the page.A solution to this would be to calculate and output the width based on the number of links that are being inserted. There are two ways you could do this. Ex1. (make the link widths a static percentage)You could do this by putting a static percentage value in the class and calculating the leftover portion with a script.Here is an example in java script: function leftover (num_of_links) { var used = num_of_links * 14; var width = (100 - used); document.getElementById('spacer').style.width = width+"%";} Here is the css ebb_navigation {position:relative;width:100%;}.ebb_navigationElement {position: relative;width: 14%;display: inline;float: left;z-index: 1;margin-left:-2px;border-right: #009286 2px solid;border-bottom: #009286 1px solid;}.ebb_navigationSpacer {height:auto;display:inline;float:left;z-index:1;border-bottom: 1px solid #009286; } You wouldn't specify the width of the spacer because it is calculated and inserted using javascript.Ex1. (make all of the links relative)I would choose to write a php function in this example because setting the attributes of a class is difficult in javascript and it would be easier to echo the value in the css code before the page loads.Creating and adding layouts dynamically is complicated and the layout is usually easier to generate with a few lines added to the loop that generates the html. I could probably work around a solution if I was working through the code that generates the html for the links. As far as I know CSS isn't capable of mixing fixed measurements (px) with relative (%) measurements. As powerful and useful as css is, it isn't magic. There are a few logical limitations to its uses.
  7. You have your navigation bar widths fixed so this should be pretty easy to do.Copy the code below into a file and view as .html <html><head><style type="text/css">.row {width:700px;height:40px;background-color:red;}.cell {width:50px;height:100%;float:left;margin-left:75px;background-color:blue;}</style></head><body><div class="row"> <span class="cell"></span> <span class="cell"></span> <span class="cell"></span> <span class="cell"></span> <span class="cell"></span></div></body></html> What I did was set the outer container for the links to be the max width (700px). Since there are 5 links. Max width = 700The links are 50px50*5 = 250pxMargin left-over = 450px450/6(margins) = 75px/margin
  8. Coolguy

    Menu is out of place

    Make an outer boundary with a container div then create inner boundaries for content, navbar, etc.On the outer boundary you'll have the pages maximum dimensions width:975px;height: auto;Then on the menu div you'd setwidth:100%;height:25px;I don't know what browser you're using but on mine (firefox) half your page is out of line. You need to create an outer div to hold everything together first (that has a fixed width). Then create divs inside that that are relative or absolutely positioned (that hold content sections, titlebar, navbar). What it looks like is you have half your page held together and positioned relatively and the other half is wild and positioned absolute.
  9. The center column doesn't extend to anything its width is static like the rest. center container = #content_container {width:480px}If you are trying to fix the pieces that are hanging on the edges of the containers just add padding to the container.
  10. Coolguy


    If you are having troubles with using the float and clear properties correctly check out this tutorial. It helps a lot.http://css.maxdesign.com.au/floatutorial/index.htm
  11. Coolguy

    DW Batch S&R

    Good point... Did I mention that I'm a newb when it comes to regular expressions. I didn't happen to see \/(escaped front-slash) under the list of escaped characters.Thanks
  12. Coolguy

    DW Batch S&R

    I don't know how to do it in DW since I replaced it /w hand-coding in notepad++ a while back but I know you can do it with php.Just setup a php processor that loads and processes the file line by line and uses preg_replace() to change the syntax. Or I can...I whipped up this little toolie in about an hour (because I'm still a php newb). I call it the DepreGrubberJust change the $LoadFile variable to the original and change the $Output variable to name the new file that will be generated and Voila. <?php$LoadFile = "input.html";$OutputFile = "output.html";$fhI = fopen($LoadFile, 'r') or die("Can't open file");$fhO = fopen($OutputFile, 'w') or die("Can't open file");$count = 0;while(!feof($fhI)) { $line = fgets($fhI); $find[0] = '/<html>/'; $replace[0] = '<TuMadre>'; $find[1] = '/<\x2fhtml>/'; $replace[1] = '</TuMadre>'; $find[2] = '/<body>/'; $replace[2] = '<Corps>'; $find[3] = '/<\x2fbody>/'; $replace[3] = '</Corps>'; $stringData = preg_replace($find, $replace, $line); fwrite($fhO, $stringData); }fclose($fhI);fclose($fhO);echo "Tu Madre un feo que asusta";?> This script is awesome because you can add as many replace-strings as you want and it works really fast. The only downside is that those pesky front slashes have to be ascii encoded. For a complete ascii table go here:http://ascii-table.com/index.phpAll this needs is a little fancy front end, and a complete index of deprecated tags and their replacements and you'll never have to go back to DW for bringing code up to current standards again.Hope that helps
  13. Coolguy

    Player Urgent

    Here... I tried to validate the XSPF output and found out that the file location needs to be a valid URI. This version adds a root directory source that's tacked to the location URI, and it uses preg_replace to convert spaces to %20. If you want to add more preg replaces I made the find and replace arrays for extensibility. For a resource of invalid chars in the URI go here:http://www.blooberry.com/indexdot/html/top...urlencoding.htmHere is the tested and working code. <?php$root = "http://testing.jpasims.net/mp3";$dir = "files"; //Specifies the directory where files will be loaded from$playlist_name = "playlist.xspf";$dh = opendir($dir);$count = 0;//Cycles through the directory and loads the the mp3List array with trackswhile (false !== ($file = readdir($dh))) { //Skips the '.' and '..' items of the directory listing if ($file != "." && $file != "..") { $isMp3 = explode('.',$file,2); // Loops through only the files with a .mp3 extension if ($isMp3[1] == "mp3") { $count += 1; $mp3List[$count] = $file; } }}closedir($dh);//The next part takes the filelisting and generates an XSPF file$fh = fopen($playlist_name, 'w') or die("can't open file");$stringData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";fwrite($fh, $stringData);$stringData = "<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\">\n";fwrite($fh, $stringData);$stringData = "<trackList>\n";fwrite($fh, $stringData);foreach ($mp3List as $track) { $stringData = "<track>\n"; fwrite($fh, $stringData); $stringData = "\t<title>$track</title>\n"; fwrite($fh, $stringData); $URI = "\t<location>$root/$dir/$track</location>\n"; // Set to replace any characters that may make the uri invalid $find = array('/ /'); $replace = array('%20'); $stringData = preg_replace($find, $replace, $URI); fwrite($fh, $stringData); $stringData = "</track>\n"; fwrite($fh, $stringData);}$stringData = "</trackList>\n";fwrite($fh, $stringData);$stringData = "</playlist>\n";fwrite($fh, $stringData);fclose($fh);?> If you wanted to incorporate both this and the mp3 player on the same page just embed the player at the top, create a little front-end to generate the playlist and waam baam thank you maam, you're done.Enjoy
  14. Coolguy

    Player Urgent

    If you have no need to modify an existing playlist then there's no point in adding the complexities of SimpleXML or DOMXML. I simply took an existing script that I use to generate html code (<img ... />) for galleries dynamically from directories of images and adapted it to generating a playlist. The format for playlist I used is XSPF because it's widely supported (online and offline), I know where to get a very simple and easy flash mp3 flash player, it's all open source, and it's a standard xml specification for media playlists. For information on the XSPF spec go here.http://www.xspf.org/quickstart/For the embedded flash mp3 player that reads the xspf files go here:http://musicplayer.sourceforge.net/#downloadHere is the code that reads a directory and outputs an XSPF file. <?php$dir = "files"; //Specifies the directory where files will be loaded from$dh = opendir($dir);$count = 0;//Cycles through the directory and loads the the mp3List array with trackswhile (false !== ($file = readdir($dh))) { //Skips the '.' and '..' items of the directory listing if ($file != "." && $file != "..") { $isMp3 = explode('.',$file,2); // Loops through only the files with a .mp3 extension if ($isMp3[1] == "mp3") { $count += 1; $mp3List[$count] = $file; } }}closedir($dh);//The next part takes the filelisting and generates an XSPF file$File = "playlist.xspf";$fh = fopen($File, 'w') or die("can't open file");$stringData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";fwrite($fh, $stringData);$stringData = "<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\">\n";fwrite($fh, $stringData);$stringData = "<trackList>\n";fwrite($fh, $stringData);foreach ($mp3List as $track) { $stringData = "<track>\n"; fwrite($fh, $stringData); $stringData = "\t<title>$track</title>\n"; fwrite($fh, $stringData); $stringData = "\t<location>$dir/$track</location>\n"; fwrite($fh, $stringData); $stringData = "</track>\n"; fwrite($fh, $stringData);}$stringData = "</trackList>\n";fwrite($fh, $stringData);$stringData = "</playlist>\n";fwrite($fh, $stringData);fclose($fh);?> Shortcomings: 1: The spaces in the xspf file need to be converted to %20. This can be done using preg_replace. I would do it myself but I haven't figured out how to use regular expressions yet2: It only loads the playlist from one directory. This script could be extended to fish through subdirectories too with a little php-fairy-dust.Sidenote: I've been looking for an excuse to write one of these for a while now. It was a good challenge and I hope it fits your needs.
  15. If you want to you could still apply the same border style to the added hover and visited pseudo-class additions like this.The main difference is I broke down the border attributes individually. The way I had it coded before was shorthand. .left a:link, .middle a:link, .right a:link {padding: 2px; border-style: solid;border-width: 1pxborder-color: #edd2ab;}.left a:visited, .middle a:visited, .right a:visited {border-color: #a0522d;}.left a:hover, .middle a:hover, .right a:hover {border-color: yellow;} This is a very efficient way to code the color change because, with on-visited and on-hover only the color of the border changes while the border-padding and border-style stay the same. In the future if you are having problems with tweaking or inheritance with short-hand tags try breaking them down into their smaller respective parts.As far as the whole borders in IE6 go... IE6 sucks at CSS in general (developers hate M$ so much because their lack of following standards and adding custom crap that only works in IE). If you goto MSDN and look up their HTML reference you can see just how much bastardizing they have done to the language.http://msdn2.microsoft.com/en-us/library/ms533050.aspxOne fix to get rid of borders on image links is by adding a 'border' attribute to the <img> element.<img src="" alt="" border="0" />Or you could still try adding:img {border: none;}This shouldn't affect your image link borders because of the stacking order of inheritance in css.HTML tags -> Class tags -> Id tagsEx. p {color: red;}.text {color:blue;}#writing {color:yellow}<p id="writing" class="text">foo bar</p> In this case 'foo bar' would be yellow, if you removed the 'id' attribute it would be blue, and so on...If that doesn't work be sure to check this out:http://locusoptimus.com/css-trickery/ie-im...es-on-hover.php
  • Create New...