Results 1 to 9 of 9

Thread: PHP Title Script

  1. #1
    (。◕‿‿◕。) Recognized Member Jojee's Avatar
    Join Date
    Dec 1999
    Posts
    9,611
    Contributions
    • Former Cid's Knight

    Moogle PHP Title Script

    Oookay. So I've been trying forever to make the title do what I want, and it seems like it should be simple! But I can't get it to work. @_@ So help. I promise I won't figure this out in 15 minutes and say "Never mind." xD

    I stripped the page down to the basics. This is my script:
    100 x 100 Avatars

    This is the script in action:
    100 x 100 Avatars

    <b>Explanation</b>: What it does is basically pulls from each directory any avatars I upload and displays them on the site. There's the $catname variable which shows the name of the folder the avatars are in minus any underscores.

    What I want is to also display the $catname in the title, but it doesn't work because I think it hasn't been declared and I tried a bunch of crap, and I'm confused? xD
    For example, if you click the "Asian Girls" category, it takes you to the page. I can get the words "Asian Girls" to display on the page via $catname, and Asian_Girls is the name of the folder all of those avatars are in.
    The title to all the pages right now is "100 x 100 Avatars." How would I get it to display "100 x 100 Asian Girls Avatars" instead, and modify for all of the other categories as well? :3

    Um so if someone has a lot of time... xD Thanks~!


    Wat
    is
    going
    on
    wtf
    rawr

  2. #2
    i n v i s i b l e Tech Admin o_O's Avatar
    Join Date
    Jun 2001
    Location
    New Zealand
    Posts
    2,957
    Blog Entries
    1

    FFXIV Character

    Humphrey Squibbles (Sargatanas)

    Default

    You're right that it won't display in the title because it's not declared at that point. You could try to do as much processing as possible at the beginning of the script, before you output any HTML. That would make the value of $catname available when you need to set it in the title.

    Also it's not related, you're missing your &lt;/head&gt; tag in that text file. I'm not sure if that's the same code as is running at the moment, but you might want to have a look.

  3. #3
    (。◕‿‿◕。) Recognized Member Jojee's Avatar
    Join Date
    Dec 1999
    Posts
    9,611
    Contributions
    • Former Cid's Knight

    Moogle

    Oh oops, I have a /head tag in the original. xD I just stripped everything down so it's pretty much the code.

    And I still can't get it to work, I dunnno @_@ I've tried like everything already. I updated the code and the script at work in the first post, if you click them. Now it just completely messes up xD

    Could you or anyone by any chance write out how to put it in the title for me? ;3


    Wat
    is
    going
    on
    wtf
    rawr

  4. #4
    Hypnotising you crono_logical's Avatar
    Join Date
    May 2001
    Location
    Back in Time
    Posts
    9,313
    Contributions
    • Former Administrator
    • Former Cid's Knight

    Default

    Are you sure the contents of code.txt match index.php? It doesn't seem to be doing what the code says to me
    Problems playing downloaded videos? Try CCCP


  5. #5
    (。◕‿‿◕。) Recognized Member Jojee's Avatar
    Join Date
    Dec 1999
    Posts
    9,611
    Contributions
    • Former Cid's Knight

    Default

    It should be the same. xD I'm sure the coding isn't in correct form or whatever, but the point is that it works and I don't really care beyond that (Well not anymore that I messed it up by putting a bunch of PHP in the beginning but I can put it back later xD)

    I just wanna know how to do the title thing ;_;


    Wat
    is
    going
    on
    wtf
    rawr

  6. #6

    Default

    Aren't you already halfway there? When I click on any of those categories I see the name being displayed at the top. If you just put it inside the &lt;title&gt;-tag you should be all set.
    In code.txt, line 115 change "h1" to "title" and the category is displayed as title. Unless I misunderstood that is what you wanted, isn't it?


  7. #7
    (。◕‿‿◕。) Recognized Member Jojee's Avatar
    Join Date
    Dec 1999
    Posts
    9,611
    Contributions
    • Former Cid's Knight

    Default

    Kinda, but oi you know what, you're right.

    I could have avoided ALL this pain by just putting the title at the end of the page.

    I've just... grown up learning that the title has to be in the &lthead&gt; section ;__; But it still displays if I put in or after the body. xD


    Wat
    is
    going
    on
    wtf
    rawr

  8. #8

    Default

    Actually the title should still be inside the head-section. But it still is, if you follow my steps. In that line, the head-tag is still open, you would have to close it some lines later and open a body tag.


  9. #9
    Ominous Wanderer Tech Admin Samuraid's Avatar
    Join Date
    Oct 2001
    Posts
    5,522

    Default

    Just a side note:

    htmlspecialchars() is your friend. You might want to escape/sanitize your input ($_GET and such).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •