Forums

[resolved] Add txt file to root of all created directories in database? (11 posts)

  1. mektek69
    Member
    Posted 3 years ago #

    I'm doing a new install of wp2.7 and I'm modifying a theme with some of the features of an old website I have.
    I'm trying to use a flash banner/menu as my main menu/banner on the site and it woks good except that there is a menu.txt file that the .swf file refers to that needs to be in the root directory for the menu function of the flash to work, and when wordpress creates subpages like http://rootdirectory/tag/events the flash file can't see the menu.txt file anymore so I loose my functionality.
    Is there a way to "hack" wordpress or add an entry to the database that will create a copy of menu.txt in the root of all directories that wordpress creates?
    Or maybe an .htaccess entry that changes all created post/pages/etc. look like their in the root directory IE:
    http://rootdirectory/tag/events
    becomes
    http://rootdirectory/events

  2. Michael Fields
    Theme Wrangler
    Posted 3 years ago #

    Not really, WordPress doesn't really create directories, it just modifies a dynamic url to appear as a directory.

    http://example.com?page_id=4

    Turns into

    http://example.com/twinkies/

    But there is no physical directory one the server named "twinkies". Messing with this part of the core is not really suggested. That being said, I can think of two very easy solutions to fix your problem:

    1. Stop using permalinks.
    2. Modify the flash script to use an absolute url: http://example.com/menu.txt

  3. mektek69
    Member
    Posted 3 years ago #

    Unfortunately I don't know the first thing about modifying flash scripts, or even what software I would use to try and do it other than Dreamweaver which costs the same as 2 months of my food budget. Lot of time to go without eating to try and learn flash. I was able to change my banner.php to use an absolute url to call the flash movie and that worked great but like I said I don't know how to change it in the swf file.
    Right now I'm not using permalinks so that it works, but I really wanted to use the permalinks feature for seo reasons as eventually the site will become at least partially a commercial site.
    I kinda figured it wasn't going to be possible but was hoping somebody here had a trick to do it.
    I actually created a bunch of dummy directories that had nothing but menu.txt in them, but quickly found out just how many dynamic url's wordpress creates. I'd have to create a million of em LOL

  4. Michael Fields
    Theme Wrangler
    Posted 3 years ago #

    Actually, I might be better at htaccess than I thought. Give this a try:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule menu.txt$ /menu.txt [L]
  5. Michael Fields
    Theme Wrangler
    Posted 3 years ago #

    Oh yeah, Add it to you .htaccess file before any of the WordPress generated code

  6. mektek69
    Member
    Posted 3 years ago #

    Stuck it in right at the beginning and it works great! Got my menu on every page I've checked so far :)
    Man I wish I understood htaccess better. 'cause that's was be-a-utfull and easy!
    I'll be reading up on htaccess on line for the next few days when I get a chance. May be able to work around my other problem with 2.7's (unofficial) paged comments bug.
    Send me your paypal email to 'quit.smoking.4ever@gmail.com' and I'll buy you a beer :), I really appreciate the help.

  7. mektek69
    Member
    Posted 3 years ago #

    oops, spoke to soon.
    the menu.txt is working great, the links show up and their clickable now but for some reason when I click on links like "blog" instead of going to the blog page it just adds that url to the end of the previous url.

    IE: I click on my news tag and go to '/rootdirectory/tag/news/' and the menu looks great, but when I click on "blog" - instead of taking me back to '/rootdirectory/blog' it takes me to '/rootdirectory/tag/news/blog' which is a 404.

    All the other links are still working including the footer menu. It's only the 5 pages linked to from the menu.txt.

    Guess I gotta do some reading like I said, but at least now I know it IS possible thanks to you.

  8. Michael Fields
    Theme Wrangler
    Posted 3 years ago #

    .htaccess is a bit of a pain to get used to mainly because of the use of regular expressions - which are like voodoo :) The following link is pretty helpful for getting started:

    http://www.addedbytes.com/apache/mod_rewrite-cheat-sheet/

    Glad this worked for you.

  9. mektek69
    Member
    Posted 3 years ago #

    Thanks for the great link :),
    I've downloaded the cheat sheet, the guide for beginners and the guide from Apache that he references in his page. It'll take few days, but I'll read every last page if I have to, I'm gonna get this to work dangit.

  10. Michael Fields
    Theme Wrangler
    Posted 3 years ago #

    Do you have a link? Most likely, the links need to be changed in your menu.txt file. If the rest of the dynamically generated WordPress links are working properly, it might make sense to just copy the ones you need and paste them in.

  11. mektek69
    Member
    Posted 3 years ago #

    OH MY GAAAWD I'm so stuuuuppiidd. I completely forgot to set up absolute url's in the txt file. I am LMAO at myself. Looking for complicated when I needed to think simple. Very embarrasing. Thanks man.
    Sure glad I stopped by the forum again before I went to bed.
    Thanks buddy.

Topic Closed

This topic has been closed to new replies.

About this Topic