Jump to content

brandinhall

Members
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

0 Neutral

About brandinhall

  • Rank
    Newbie
  1. No luck with that : /
  2. Heres what I have: <?php$pageName = basename($_SERVER['SCRIPT_NAME'], '.php');$pageMeta = $metaInfo[$pageName];$metaInfo = array( 'testing2' => array( 'descr' => 'this is a discription for testing2', 'author' => 'I am the author of testing2' ), 'about' => array( 'descr' => 'about desc text', 'author' => 'about author text' ));/*if($pageName == "testing2"){$pageName = "PHP is Fun!";} */$output = '<meta name="description" content="' . $pageMeta['descr'] . '"/>';$output .= '<meta name="author" content="' . $pageMeta['author'] . '"/>';?><!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><title><?php echo $metaInfo['testing2']; ?> </title><?php echo $output; ?></head><body>test</body></html> Any hints?
  3. I thought by doing: $metaInfo = array( 'testing2' => array( 'descr' => 'this is a discription for testing2', 'author' => 'I am the author of testing2' ), It would tell the output, if my page is called testing2then to output $output = '<meta name="description" content="' . $pageMeta['descr'] . '"/>';$output .= '<meta name="author" content="' . $pageMeta['author'] . '"/>'; Are you saying I need to define a special array somehow?I am reading on w3schools about arrays, perhaps I am missing or my question is to tailored to something specific, please elaborate if you don't mind how the logic and working of this
  4. Can you explain what you mean by 'theres is no index ref for testing2 from testing2.php'
  5. Awesome help guys! This is what I have. <?php$pageName = basename($_SERVER['PHP_SELF']);$homeMeta = $metaInfo[$pageName]; $metaInfo = array( 'testing2' => array( 'descr' => 'home desc text', 'author' => 'home author text' ), 'about' => array( 'descr' => 'about desc text', 'author' => 'about author text' ));$output = '<meta name="description" content="' . $homeMeta['descr'] . '"/>';$output .= '<meta name="author" content="' . $homeMeta['author'] . '"/>';?> <!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><title><?php echo $pageName ?></title><?php echo $output; ?> </head><body>test</body></html> When I view my HTML source from the webserver I am not correctly printing the meta (BUT) take a look.. <!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><title>/testing2.php</title><meta name="description" content=""/><meta name="author" content=""/></head><body>test</body></html> The Meta Info is Printed but without the details I'm trying to create for it.Now when I try to use my brain.... This is how I'm understanding the process When I use this: $pageName = basename($_SERVER['PHP_SELF']); It tries to pull information up on Which page we are on. When when we use this: $metaInfo = array( 'testing2' => array( 'descr' => 'home desc text', 'author' => 'home author text' We are saying that if we are on page "testing2" (testing2.php is the name of my file) then we will print the values: 'descr' => 'home desc text', 'author' => 'home author text' to the out put $output = '<meta name="description" content="' . $homeMeta['descr'] . '"/>';$output .= '<meta name="author" content="' . $homeMeta['author'] . '"/>'; Now if I understand this correctly... I am going wrong somewhere along the lines of where the Page title is triggering what info to output?Edit: Or Where my page name doesn't sync correctly with the value ive given it to output?
  6. Okay based on your information this was my attempt.Heres the code I did: <?php$pageName = $_SERVER["SCRIPT_FILENAME"];$homeMeta = $metaInfo[$pageName];$metaInfo = array( 'home' => array( 'descr' => 'home desc text', 'author' => 'home author text' ), 'about' => array( 'descr' => 'about desc text', 'author' => 'about author text' ));$output = '<meta name="description" content="' . $homeMeta['descr'] . '"/>';$output .= '<meta name="author" content="' . $homeMeta['author'] . '"/>';?><!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><title><?php echo $pageName ?></title><?php echo $metaInfo ?></head><body>test</body></html> When I test it on my web server I get the output: " Array test " and the title of my page becomes: <title>/home/content/a/d/u/testsite/html/testing2.php</title>here is the HTML Source when viewing the page: <!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><title>/home/content/a/d/u/adulthustlers/html/testing2.php</title>Array</head><body>test</body></html> Sorry im so daft "thescientist" lol
  7. Hey, lol! that worked!! How would you go about making this <?php$tpTitle="Helping you to improve your web site";$pgHeading="Site-Report.com - Helping you to improve your web site";$pgDesc="Helping you to improve your web site";$pgKeywords="site-report";?> Pull the keywords, desc and titles from a file base on what page we are on?
  8. thanks for not being an ###### towards my lack of knowledge! lolI was just reading further to try and understand more of what you said. I came across this http://www.cre8asiteforums.com/forums/index.php?showtopic=4558&st=0 This guy mentions a way that seemed a bit more simple (to me, the noob) haha. <?php $tpTitle="Helping you to improve your web site"; $pgHeading="Site-Report.com - Helping you to improve your web site"; $pgDesc="Helping you to improve your web site"; $pgKeywords="site-report"; ?> So i get that we define "params?" and then he says we can add this to our header. <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><title><?php echo $tpTitle ?></title><meta name="description" content="<?php echo $pgDesc ?>"></meta><meta name="keywords" content="<?php echo $pgKeywords ?>"></meta></head> and then we "echo" or print them out in the head. That made alot of sense, I went ahead and made a page called testing.php, when i uploaded it to my server and viewed the page my title/meta tags hadn't changed. Here's my code (that didnt work) <html> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><title><?php echo $tpTitle ?></title><meta name="description" content="<?php echo $pgDesc ?>"></meta><meta name="keywords" content="<?php echo $pgKeywords ?>"></meta></head><body> <?php$tpTitle="Helping you to improve your web site";$pgHeading="Site-Report.com - Helping you to improve your web site";$pgDesc="Helping you to improve your web site";$pgKeywords="site-report";?> </body></html> This works perfectly for me if i can get it to work. osDate includes a header file and footer file. The index.php file includes templates like "homepage.tpl" but if i can just define what the page should echo on every page, it'd work perfectly. I used this concept only because it seemed simple to me and yours was difficult, I'm gonna read up some more on what you suggested and try to understand it better.. Do you know why my code didn't "echo" when i viewed it in my browser on my server?
  9. Hey guys!I was wondering if someone would be kind enough to help me out. I am not really a programmer or savvy in that type of nature. I know HTML / CSS but really my experience is in the design field. I am using software called osDate.osDate allows you to give your site a title and meta tags from the admin interface, BUT... osDate doesn't support changing your title/meta tags for specific pages, this is a huge problem for me and the SEO of my site! Here's what I need and I'm hoping someone can help me out with. I want to know if someone could write me a quick tutorial or possibly show me how the code would work to do the following: IF we are on page 'page.php' then use 'THIS' as my title site. As an added bonus, I wonder would hard it would be to fetch 'THIS' from.. let's say a text file? or php file where i can define all the titles etc that get pulled into my title/meta tags? (the same theory would be applied in the meta tags/description) if anyone could gimme a hard, I'd greatly appreciate it! Thanks!
×
×
  • Create New...