Jump to content

Donny Bahama

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Donny Bahama

  • Rank
  1. Donny Bahama

    Formatting URL with section link and GET parameters

    I did some trial and error. In case anyone else needs to know, the second example worked. The first example did not.
  2. If I want to link to a section/element within a page, and also pass GET parameters, which would be correct: http://mysite.net/thispage.php#section1?ref=123 OR... http://mysite.net/thispage.php?ref=123#section1 Or, if neither is correct, what's the right way?
  3. Donny Bahama

    Please help me understand variable scope in this context...

    Nevermind. I figured out the problem. Thanks for the help!
  4. Donny Bahama

    Please help me understand variable scope in this context...

    Thank you, Ingolme. Including those blocks made my test file work. But my actual files are more complicated. They're basically a full web page, divided up into chunks so I can require the header file and require the footer file so that, if I decide to make changes to the navmenu or the footer, I only have to change them in one place. Everything worked beautifully until I decided I wanted to mix in some php. Under those circumstances, what is the right way to do this?
  5. Donny Bahama

    Please help me understand variable scope in this context...

    In the actual (not the test) files, there's a bunch of html code in part1, then I use the php open/close tags, run several commands which result in a bunch of text being assigned to a variable ($promotext) then, in part2, I try to write that string to the page (again, in the middle of a bunch of html code, so I use <?php echo $promotext; ?> but the text isn't shown on the final/main page.
  6. Donny Bahama

    Please help me understand variable scope in this context...

    Thank you for your response, iwato. I was only using fopen/fwrite/fread as an alternative method to try to get the variable text from one part to another (because it's just NOT working for me. I tried a simple test... Complete contents of test1.php: <?php require "part1.php"; require "part2.php"; require "part3.php"; ?> Complete contents of part1.php: $city = "Danville"; Complete contents of part2.php: $citydesc = "pleasant"; Complete contents of part3.php: echo "$city is a $citydesc place to live."; When I go to test1.php in my browser, here is the full text of the page:
  7. Let's say I have main.php which consists of: <?php require "part1.php"; require "part2.php"; require "part3.php"; ?> If I define/set a variable in part1.php (i.e. $city = "Danville"; ), shouldn't I be able to echo $city in part2.php ? If not, why not? (And what would be the appropriate workaround? I've tried using fopen/fwrite/fread but for some reason, the file isn't being written. :frustrated:)
  8. Donny Bahama

    What's wrong with my nav menu?

    If you click on the "Services" item in my navigation menu, the nav bar gets really tall (instead of just a portion of it dropping down) and all the items in the nav menu get aligned to the bottom. It looks pretty crappy. Can anyone suggest the best/right way to correct it? Thanks for your time and consideration!
  9. Donny Bahama

    Includes within HTML files?

    I found the answer here: https://www.w3schools.com/howto/howto_html_include.asp Only it doesn't work.
  10. Donny Bahama

    Includes within HTML files?

    It occurs to me that it might be a good idea to have the pages on my site be modular... Is there some way I can just include (like I would in php) a file for my banner, navigation, footer, etc. I'm currently going through and editing every file on my site - all because I decided to make a change to my nav menu. If I have to go with php pages instead, I can do that, but I thought I'd check first. If there is a way to do this, is it well-supported by all browsers (even old ones/IE/etc.)? If I have to go with php pages, are there SEO issues/complications to doing so? I would assume they would only look at the rendered pages, right?
  11. Donny Bahama

    How to position an element to the top of the visible screen

    Wow! That works great! (I wish I understood why it works. ".popup:before" would be a lot more logical than ".popup:after") Anyway, thank you! I think I can adapt that to work for me.
  12. Donny Bahama

    How to position an element to the top of the visible screen

    That doesn't seem to work. It places it within the div (where all the popups are - at the bottom of the main content) with a top margin that looks to be about 10% of the screen height. (I used 10vh.) I tried using position:absolute instead of fixed. Same result.
  13. I'm using a script that toggles different popup divs when different links are clicked. The problem is the placement of the popup with regard to the screen height. I always want the popups centered horizontally so each popup has margin-left and margin-right set to auto -- but setting margin-top and margin-bottom to auto doesn't work. Is there some way to position the popups at the top of the visible screen so that even if it's viewed on a relatively small screen (i.e. a smartphone in portrait mode), the popup will still pop up in a place that's vertically appropriate, regardless of how far down the page the user has scrolled? The fact that position:sticky exists makes me think that there must be some way of doing this but when I try to detect where the top of a sticky background image is, I always get 0px.
  14. Donny Bahama

    Thank you, W3Schools!

    I just want to post a big THANK YOU! to W3Schools. It's my go-to reference for HTML, CSS and Javascript. The Try-It editor is awesome and SO useful. You guys ROCK!
  15. Donny Bahama

    Breaking a line of text in the middle

    Here's something interesting I tried that seems like a good start. I'll document it here in case it helps anyone else... I broke the line of text into 4 (approx. equal length) chunks. within each chunk, I replaced the spaces with non-breaking space characters - &nbsp;, leaving actual spaces between each of the quarters. That seems to help a lot. Now I'll play with max-width and breakpoints to get it right where I want it.