PHP - Meta Data Help
I would like to be able to have my meta data pick out the information of a page and insert it into the meta tags.
I have a controller class which has the coding to get the data, which is this: controller.class.php Code: [Select] function get_title(){ $title=''; if (isset($this->_params['item']['meta_title']) && !empty($this->_params['item']['meta_title'])){ $title=$this->_params['item']['meta_title']; } $title=strip_tags($title); $title=str_replace('"', '\'', $title); $title=trim($title); if (strlen($title)>150){ $end_of_last_sentence=strpos($title, '.', 150)+1; if ($end_of_last_sentence<150){ $end_of_last_sentence=150; } $title=substr($title, 0, $end_of_last_sentence); } return $title; } function get_description(){ $description=''; if (isset($this->_params['item']['meta_description']) && !empty($this->_params['item']['meta_description'])){ $description=$this->_params['item']['meta_description']; } $description=strip_tags($description); $description=str_replace('"', '\'', $description); $description=trim($description); if (strlen($description)>150){ $end_of_last_sentence=strpos($description, '.', 150)+1; if ($end_of_last_sentence<150){ $end_of_last_sentence=150; } $description=substr($description, 0, $end_of_last_sentence); } return $description; } function get_keywords(){ $keyword=''; if (isset($this->_params['item']['meta_keyword']) && !empty($this->_params['item']['meta_keyword'])){ $keyword=$this->_params['item']['meta_keyword']; } $keyword=strip_tags($keyword); $keyword=str_replace('"', '\'', $keyword); $keyword=trim($keyword); if (strlen($keyword)>150){ $end_of_last_sentence=strpos($keyword, '.', 150)+1; if ($end_of_last_sentence<150){ $end_of_last_sentence=150; } $keyword=substr($keyword, 0, $end_of_last_sentence); } return $keyword; } Then I have a pages.controller which has the coding for the home page pages.controller.php Code: [Select] public function home(){ //instantiate a model $galleries_model = new galleries_model('galleries'); $galleries = $galleries_model -> get_all(); foreach($galleries as $gallery){ //how to loop through an image so that only the first //image is selected $sql = "SELECT image_path FROM gallery_images WHERE gallery_id = {$gallery['id']} ORDER BY order_by"; $image = $this->_model->get_one($sql); $gallery['image'] = $image; $this->_params['list'][] = $gallery; } $this->_params['item'] = $this->_model->get(array("pages.name = 'home'")); } Code: [Select] galleries.controller.php public function galleries(){ $galleries = $this->_model->get_all(); $this->_params['list'] = $galleries; } public function view($gallery_id){ $this->_params['item'] = $this->_model->get($gallery_id); $this->_params['item'] ; //die; } This is my default page where I want the meta tags to echo out the relevent information default.php Code: [Select] !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 $this->get_title(); ?></title> <meta name="Description" content="<?php echo $this->get_description(); ?>" /> <meta name="Keywords" content="<?php echo $this->get_keywords(); ?>" /> <title>Welcome to the Framework</title> <?php $this->_page->add_javascript('/vendor/lightbox/js/jquery.lightbox-0.5.min.js'); $this->_page->add_stylesheet('/vendor/lightbox/css/jquery.lightbox-0.5.css'); echo $this->page('stylesheets'); echo $this->page('javascripts'); ?> </head> <body> <h1> Welcome to the My site </h1> <?php echo $this->page('view');?> </body> </html> In the pages.controller.php I managed to get it to work using $this->_params['item'] = $this->_model->get(array("pages.name = 'home'")); I want to be able to do the same thing on different pages but I can't get it to work. I hope I explained it clearly. Thank you Similar TutorialsOk so i'm not a programmer of any kind however I'm trying to enter what I believe is HTML generated metadata into the header.php of my wordpress theme here is how the wordpress header reads ?> <!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" <?php language_attributes(); ?>> <head profile="http://gmpg.org/xfn/11"> <title><?php if ( is_single() ) { single_post_title(); } elseif ( is_home() || is_front_page() ) { bloginfo('name'); print ' | '; bloginfo('description'); get_page_number(); } elseif ( is_page() ) { single_post_title(''); } elseif ( is_search() ) { bloginfo('name'); print ' | Search results for ' . wp_specialchars($s); get_page_number(); } elseif ( is_404() ) { bloginfo('name'); print ' | Not Found'; } else { bloginfo('name'); wp_title('|'); get_page_number(); } ?></title> <meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> AND HERE IS WHAT I WANT TO PLACE I just don't know where I put it. It gives me Syntax errors when I paste just above the last title tag....does it need to be in php form and if so how do i change it? thanks for anyones help, sorry if this is a lame question but I've been slapping my head against a wall for 4 hours now Page: http://www.dylanpatrickarts.com/ <title>NYC Headshots, Lifestyle Portraits, Corporate, PR, Live Music</title> <meta name="description" content="Providing quality affordable NYC Headshots to the working actor, as well as Lifestyle Photography, Corporate Photography, Public Relations Photography, and much more! I strive to push my creative potential at all times, while having fun doing it!"> <meta name="keywords" content="photography,wedding photography,headshots,headshot,actors headshot,headshots nyc,nyc headshots,new york city headshot photography,headshot photographers in new york city,portraits,portrait,portrait photographer,hospitality photography,live music photography,public relations photography"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/headshots/ <title>NYC Headshots</title> <meta name="description" content="A collection of NYC Headshots for actors, dancers, and models"> <meta name="keywords" content="headshots,headshot,good headshots examples,actors headshots,actors headshot,headshots nyc,nyc headshots,new york city headshot photography,headshot photographers in new york city,new york headshots,actors,headshot photography,headshot photography in nyc,affordable headshots,affordable headshots nyc"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/ <title>Portfolio</title> <meta name="description" content="A collection of NYC Headshots, People Photography, Live Music Photography, Scenic Photography, and Public Relations Photography, as well as a gallery for you to buy prints!"> <meta name="keywords" content="headshots,actors headshots,actors headshot,headshots nyc,headshot photographers in nyc,portrait photography,abstract photography,scenic stock photography,live music photography,music photography,hospitality photography,hotel photography,public relations,cocktail photography,buy print photography"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/people/ <title>People</title> <meta name="description" content="A collection of Portraits, Candids, and Outtakes"> <meta name="keywords" content="people photography,people stock photography,black white photography of people,portrait photography,family portrait photography,headshots,headshot,actors headshot,actors headshots,photographers in new york city,new york city corporate photographer,headshot photographers in new york city,dylan,candids"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/live-music/ <title>Live Music</title> <meta name="description" content="A collection of Live Music work in NYC"> <meta name="keywords" content="music photography,photography,live music photography,live music nyc,new york city live rock music,bleecker street"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/pr-work/ <title>PR Work</title> <meta name="description" content="A collection of public relations and hospitality work. "> <meta name="keywords" content="public relations,public relations photography,hospitality,hospitality photography,cocktails,cocktail,dylan,bentley,clients,empire"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/tear-sheets/ <title>Tear Sheets</title> <meta name="description" content="A collection of published work"> <meta name="keywords" content="tear sheets,photography,actors headshots,actors headshot,headshot,headshots,headshots nyc,nyc headshots"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/scenic-artistic/ <title>Scenic & Artistic</title> <meta name="description" content="A collection of scenic and artistic work. Certain photos also available for purchase!"> <meta name="keywords" content="scenic stock photography,scenic photography,scenic photography for sale,abstract photography,artistic photography,hdr photography,hdr photography galleries,examples of hdr photography,scenic,new york city,new york city skyline,san francisco,idaho"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/galleries/buy-prints/ <title>Buy Prints</title> <meta name="description" content="A collection of available prints for purchase."> <meta name="keywords" content="web site shopping cart,shopping cart,buy photography,buy scenic photography"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/your-shoot/ <title>Your Shoot</title> <meta name="description" content="Details about your headshot session."> <meta name="keywords" content="headshots nyc,nyc headshots,headshots,headshot,actors headshots,actors headshot,information,clients,consultation,dylan,people,portfolio,testimonials"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/pricing/ <title>Pricing</title> <meta name="description" content="Pricing information for headshot sessions"> <meta name="keywords" content="headshot pricing,pricing information,nyc headshots,headshots,headshot,actors headshot,photography prices,digital photography prices,prices for photography,headshot photography prices,nyc headshot photography prices,wardrobe,session"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/testimonials/ <title>Testimonials</title> <meta name="description" content="Testimonials from some of my wonderful clients!"> <meta name="keywords" content="testimonials,testimonial,photographer testimonials,headshots,headshot,actors headshots,actors headshot,headshot photographers in nyc,headshot photography in nyc,nyc headshot photographers,headshots nyc,nyc headshots,photographer,dylan,amazing"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/resources/ <title>Resources</title> <meta name="description" content="A few links to photographers, and some cool places"> <meta name="keywords" content="photography links,headshots,headshot,actors headshot,actors headshots,headshot photographers in nyc,nyc headshot photographers,acting schools links,the empire hotel,the empire hotel new york"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/blog/ <title>Blog</title> <meta name="description" content="Official Blog for Dylan Patrick Photography"> <meta name="keywords" content="blog,photography blogs,blogs on photography,photography,portraits,portrait,portrait photographer,portrait photographers,headshot photographers in nyc,headshot photographers in new york city,nyc headshot photographers,headshots nyc,nyc headshots,headshots,headshot"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/about/ <title>About Dylan</title> <meta name="description" content="A short bio about Dylan Patrick"> <meta name="keywords" content="nyc headshots,dylan patrick arts,dylan patrick photography,headshot photographers in nyc,headshot photographers in new york city,nyc headshot photographers,headshot,headshots,actors headshot,actors headshots"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/contact/ <title>Contact</title> <meta name="description" content="Contact information for Dylan Patrick"> <meta name="keywords" content="contact info,headshot photographers in nyc,headshot photographers in new york city,nyc headshot photographers,portraits,portrait,portrait photographers"> ==================================================================================================================== Page: http://www.dylanpatrickarts.com/shopping-cart/ <title>Shopping Cart</title> <meta name="description" content="Your Shopping Cart"> <meta name="keywords" content="web site shopping cart,shopping cart,buy photography,buy scenic photography"> hello and good day
first of all:; i hope youre all right and everything goes well at your site;: Worpress-Plugin API - giving back the meta-data according the usage of different filters
I'm currently working on a parser to make a small preview on the newest plugins in wordpress. at the moment i think i work from a URL given out of the range of these: https://de.wordpress.org/plugins/browse/popular/ - let us say the first 30 to 40 URL-pages.
What i subsequently want to filter out after the fetch is - those plugins that have the newest timestamp Version: 1.9.5.12 installations: 10,000+ WordPress Version: 5.0 or higher Tested up to: 5.4 PHP Version: 5.6 or higher Tags 3 Tags: database member sign-up form volunteer Last updated: 19 hours ago plugin-ratings
Supported arguments per action +--------------------+---------------+--------------------+----------+----------------+ | | | | | | +--------------------+---------------+--------------------+----------+----------------+ | Argument Name | query_plugins | plugin_information | hot_tags | hot_categories | | $slug | No | Yes | No | No | | $per_page | Yes | No | No | No | | $page | Yes | No | No | No | | $number | No | No | Yes | Yes | | $search | Yes | No | No | No | | $tag | Yes | No | No | No | | $author | Yes | No | No | No | | $user | Yes | No | No | No | | $browse | Yes | No | No | No | | $locale | Yes | Yes | No | No | | $installed_plugins | Yes | No | No | No | | $is_ssl | Yes | Yes | No | No | | $fields | Yes | Yes | No | No | +--------------------+---------------+--------------------+----------+----------------+
regards dil_Bert
cf: https://developer.wordpress.org/reference/functions/plugins_api/ $fields = array( 'active_installs' => true, // rounded int 'added' => true, // date 'author' => true, // a href html 'author_block_count' => true, // int 'author_block_rating' => true, // int 'author_profile' => true, // url 'banners' => true, // array( [low], [high] ) 'compatibility' => false, // empty array? 'contributors' => true, // array( array( [profile], [avatar], [display_name] ) 'description' => false, // string 'donate_link' => true, // url 'download_link' => true, // url 'downloaded' => false, // int // 'group' => false, // n/a 'homepage' => true, // url 'icons' => false, // array( [1x] url, [2x] url ) 'last_updated' => true, // datetime 'name' => true, // string 'num_ratings' => true, // int 'rating' => true, // int 'ratings' => true, // array( [5..0] ) 'requires' => true, // version string 'requires_php' => true, // version string // 'reviews' => false, // n/a, part of 'sections' 'screenshots' => true, // array( array( [src], ) ) 'sections' => true, // array( [description], [installation], [changelog], [reviews], ...) 'short_description' => false, // string 'slug' => true, // string 'support_threads' => true, // int 'support_threads_resolved' => true, // int 'tags' => true, // array( ) 'tested' => true, // version string 'version' => true, // version string 'versions' => true, // array( [version] url ) );
what do you say-!? Hi I have the following code, this code is suppose to get the data from the galleries table and the pages table. I think my problem is the sql statement but I'm not sure. Code: [Select] public function galleries(){ foreach($this->_params['list'] as $gallery){ $id = $gallery['id']; $name = $gallery['name']; $select = "SELECT * FROM pages, galleries WHERE pages.name = {$gallery['name']}"; $this->_params['item'] = $this->_model->get(array("pages.name = 'galleries.name'")); } the code Code: [Select] $this->_params['item'] = $this->_model->get(array("pages.name = 'galleries.name'")); works just fine with the home page and all the other pages. I have 2 galleries called gallery 1 and gallery 2, now my problem is that I need the sql to go through the galleries table look for the name and then look through the pages table and get the meta data from the same name. There is no foreign id because I only need it for the galleries and nothing else. Thank you I am using a script that get the field names from a table in a database. It works, however, when I try to remove the underscore(_) from the name. I get an error message. Quote Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\CMS\admin\includes\get_table.php on line 76 This is the section of code that I am using it with Code: [Select] $i = 2; while ($i < mysql_num_fields($fieldnamesquery_result)) { $meta = mysql_fetch_field($fieldnamesquery_result, $i); // This is the line of code that I am having problems with $meta.name = str_replace("_", " ", $meta.name); if (!$meta) { echo "No information available"; } $tablecolumn .= "<p>" . $meta->name . ":<input type='text' name='" . $meta->name . "' id='" . $meta->name . "'/></p>"; $i++; Hi I am trying to pull title and meta description from an URL.. To pull the URL I am using the code from http://www.dreamincode.net/code/snippet4625.htm... function getTitle($Url){ $str = file_get_contents($Url); if(strlen($str)>0){ preg_match("/\<title\>(.*)\<\/title\>/",$str,$title); return $title[1]; } } //Example: echo getTitle("http://www.cnn.com"); And to pull the meta description I am using the code from http://php.net/manual/en/function.get-meta-tags.php. // Assuming the above tags are at www.example.com $tags = get_meta_tags('http://www.cnn.com/') or die("Could not fetch meta tags"); // Notice how the keys are all lowercase now, and // how . was replaced by _ in the key. echo $tags['author']; // name echo $tags['keywords']; // php documentation echo $tags['description']; // a php manual echo $tags['geo_position']; // 49.33;-86.59 So my complete code looks like this: <html> <head> </head> <body> <?php function getTitle($Url){ $str = file_get_contents($Url); if(strlen($str)>0){ preg_match("/\<title\>(.*)\<\/title\>/",$str,$title); return $title[1]; } } //Example: echo getTitle("http://www.cnn.com"); // Assuming the above tags are at www.example.com $tags = get_meta_tags('http://www.cnn.com/') or die("Could not fetch meta tags"); // Notice how the keys are all lowercase now, and // how . was replaced by _ in the key. echo $tags['author']; // name echo $tags['keywords']; // php documentation echo $tags['description']; // a php manual echo $tags['geo_position']; // 49.33;-86.59 ?> Test! </body> </html> But it wont work... All I get is "Could not fetch meta tags".. I've tried different URLs and such but still wont work .. Anyone have an idea? hi guys what is the difference between setting the php charset header, and setting the html meta charset? Hi there, Please forgive my ignorance as i am a noob. I have a website and the page title, keywords and description are taken from this .conf file: base = /home/websitem/public_html/worms/ url = http://www.websitemakeover.co.za/worms/ host = localhost user = websitem_worms pass = ***** data = websitem_worms subject = The Organic Grow Shop shop_email = do-not-reply@organicgrowshop.co.uk shop_name = The Organic Grow Shop domain = websitemakeover.co.uk admin_email = ron@rondarby.com subjectToClient = Your Purchase from The Organic Grow Shop subjectToAdmin = A purchase was made on the website pay_email = ron_1320155944_biz@rondarby.com pay_currency = GBP #pay_url = https://www.paypal.com/cgi-bin/webscr pay_url = https://www.sandbox.paypal.com/cgi-bin/webscr [home] title = Buy worm castings, perlite, vermiculite, clay pebbles keywords = Worm castings, perlite, guano, organic gardening, hydroponic growing media, soil mixes, plagron, bio bizz, all-mix, organic fertilisers, organic nutrients, hydroponics. description = We sell organic fertilisers, worm castings, guano, perlite, vermiculite, clay pebbles, soil enhancers and conditioners to make your own soil mixes [about] title = About Us keywords = Worm castings, perlite, guano, organic gardening, hydroponic growing media, soil mixes, plagron, bio bizz, all-mix, organic fertilisers, organic nutrients, hydroponics. description = We sell organic fertilisers, worm castings, guano, perlite, vermiculite, clay pebbles, soil enhancers and conditioners to make your own soil mixes [contact] title = Contact Us keywords = Worm castings, perlite, guano, organic gardening, hydroponic growing media, soil mixes, plagron, bio bizz, all-mix, organic fertilisers, organic nutrients, hydroponics. description = Contact The Organic Grow Shop here. An organic grow shop representative will be in touch shortly. [casting] title = Worm Castings - Buy worm castings, organic soil mix at The Organic Grow Shop. Made in the UK! Keywords = Worm castings, worm tea, worm poop for hydroponics, soil mixes, plagron bat mix, organic fertiliser, vermicompost, worm castings uk, organic soil mix cannabis, organic soil, worm cast, organic soil mix, soil mixes, organic soils, natural fertilisers. description = Worm castings - mmm, wormy goodness. We've teamed up with our local worm farm to bring your this fantastic 100% natural organic plant fertilser and soil conditioner to make your own soil mixes. [perlite] title = Perlite - Buy Perlite, Vermiculite. [cart] title = Shopping Basket [checkout] title = Details to Checkout [paypal] title = Redirect to PayPal I have tried editing it but the titles don't change?? Do i need to do something else to get this to change? Your help would be really appreciated, desperately need to get this sorted! Matt so i set names for every pages, like $pageName = 'home'; //index page Code: [Select] if($pageName == 'categories'){ $find = "Birds & Bees"; $result = strpos($title,$find); echo '1'; }else if($pageName == 'categories'){ $find1 = "Money & Honey"; $result = strpos($title,$find1); echo '2'; } now the issue is with categories.php page, which is just one page but displays different title and according to matching title i wish to change the description but its not happening, everywhere only 1 prints, why? hello guys, i have a php website, which is: www.hireasunbed.co.uk the middle is like an iframe but im wondering how can i get each catagory have diffrent meta keywords and descriptions. Is this possible? Hi guys,
I have a problem with my code.
It connects with the database but it doesn't execute anything.
I am trying to update a value in a table but I really don't know what I am doing wrong.
I am trying to change the price based on the meta_value GF-1370
Thank you very much.
Here is Table (Taken from myphpadmin)
meta_id post_id meta_key meta_value
18538
4356
_sku
GF-1370
18541
4356
_price
2.343
and here is my code:
<?php $link = mysql_connect('server', 'username', 'password'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db(wordpress_i12dhflgoa); $sql="update `wp_pzvy_postmeta` set `_price` = 5 WHERE `_sku` = 'GF-1370'"; ?> Hello Every one Please see my code <?php include ("includes/config.php"); $afurl = $_SERVER['REQUEST_URI']; $afurl = preg_replace('/\/+/', '', $afurl); $afurl = preg_replace('/\;+/', '', $afurl); $afurl = preg_replace('/\&+/', '', $afurl); $afurl = preg_replace('/\#+/', '', $afurl); $afurl = preg_replace('/\|+/', '', $afurl); $afurl = preg_replace('/\@+/', '', $afurl); $afurl = preg_replace('/\%5B+/', '', $afurl); $afurl = preg_replace('/\%5D+/', '', $afurl); $afurl = preg_replace('/\%27+/', '', $afurl); $afurl = preg_replace('/\%C2+/', '', $afurl); $afurl = preg_replace('/\%BB+/', '', $afurl); $afurl = preg_replace('/quot+/', '', $afurl); $afurl = preg_replace('/\%E2+/', '', $afurl); $afurl = preg_replace('/\%80+/', '', $afurl); $afurl = preg_replace('/\%93+/', '', $afurl); $afurl = preg_replace('/\$+/', 'c', $afurl); $afurl = preg_replace('/\"+/', '', $afurl); $afurl = preg_replace('/\?+/', '', $afurl); $afurl = preg_replace('/\.html+/', '', $afurl); $afurl = preg_replace('/\-+/', ' ', $afurl); $queryArray = explode(" ", $afurl); for ($i=0; $i< count($queryArray); $i++) { $keyworddd = mysql_real_escape_string($queryArray[$i]).","; echo $keyworddd; } ?>I Want Set $keyworddd at he <meta name="keywords" content="$keyworddd"> Can anyone tell me how to do this please? Hi Everyone, I need some help which I think should not take long to figure out but I need help with it regardless. This is through wordpress. My issue is that my navigation has categories. Like Web design, Web Marketing, and Graphic design. I downloaded All in one SEO pack and everything is great up to the point where I can't add a title to the categories. When you click on the categories in the navigation the title doesn't change to what I set it to. But the description and all other meta tags are fine. I do have: Code: [Select] <head profile="http://gmpg.org/xfn/11"> <link rel="shortcut icon" href="http://www.newmediasources.ca/images/pt-logo.png"/> <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title> <?php wp_head(); ?> <link href="<?php bloginfo('template_directory'); ?>/style.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_directory'); ?>/css/ddsmoothmenu.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_directory'); ?>/css/prettyPhoto.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_directory'); ?>/css/nivo-slider.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.form.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/ddsmoothmenu.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.nivo.slider.pack.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.prettyPhoto.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/custom.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/cufon-yui.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/Museo_Slab_500_400.font.js"></script> <!-- Cufon init --> <script type="text/javascript"> <?php if(get_option('boldy_cufon')!="no"):?> Cufon.replace('h1',{hover: true})('h2',{hover: true})('h3')('.reply',{hover:true})('.more-link'); <?php endif ?> </script> <script type="text/javascript"> $(document).ready(function(){ $('#quickContactForm').ajaxForm(function(data) { if (data==1){ $('#success').fadeIn("slow"); $('#bademail').fadeOut("slow"); $('#badserver').fadeOut("slow"); $('#contact').resetForm(); } else if (data==2){ $('#badserver').fadeIn("slow"); } else if (data==3) { $('#bademail').fadeIn("slow"); } }); }); </script> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <?php wp_get_archives('type=monthly&format=link'); ?> <?php //comments_popup_script(); // off by default ?> </head> in header.php so it should be okay. I tried removing the title tag thinking it will add it itself but it didn't. Any ideas? Thank you for your time. I have a page with an iframe in it like so. <iframe src="page.php" width="100" height="100"></iframe> The page.php file, I have a meta refresh in it. <meta http-equiv="refresh" content="2; url=http://www.blah.com"> Now when I load the website, it doesn't refresh the page.php iframe. It just stays loaded without refreshing. How can I reload an iframe without the user clicking on a link inside the iframe?? I also tried a header redirect but that didn't work. Thanks. How do you give pages that are generated using the _Get method it's own meta tags? Not sure if I'm explaining this properly so allow me to elaborate: When a visitor clicks on an article on my site, they get redirected to a new page (index.php?action=article1) within the original page (index.php). Now, since it's more or less the same page, the meta tags are the same, but I was wondering if there is a way I could make it to where each article has it's own unique tags so when a visitor, for instance, clicks "share on facebook", the title and description of that article appears. Does anyone know what I'm talking about? If so, is there a way to do this? This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=322718.0 I looked for and found a similar thread, but the resulting bunny trail was specific to that OP's situation. I'll jump right to it. I've seen this done on another site, and I want to implement it the same way on another site I'm doing. Any typical page of the site will have includes files, quite a few of them nested like those little russian dolls. For instance, the about us page calls includes/header.php... <?php include("includes/header.php") ?> ...and the header.php file calls the meta information... <?php include("includes/site_titles.php") ?> <?php include("includes/site_keywords.php") ?> <?php include("includes/site_descriptions.php") ?> ...and those files have arrays... <?php $SITE_TITLES = array(); $SITE_TITLES['about_us'] = $SITE_TITLE . " About Us"; $SITE_TITLES['page2'] = $SITE_TITLE . " page2"; $SITE_TITLES['page3'] = $SITE_TITLE . " page3"; ?> ...and going back to our header.php, in the appropriate place, we echo the title and meta... <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title><?=$SITE_TITLES[$page]?></title> <meta name="description" content="<?php echo $SITE_DESCRIPTIONS[$page]?>" /> <meta name="keywords" content="<?php echo $SITE_KEYWORDS[$page]?>" /> ...which, when uploaded, *should* display in "view source" the correct title tag, keywords, and description. However, when I do this, I get empty tags. Am I supposed to define the site variable ($SITE)? Or am I doing something else wrong? I have the original source where I first saw this in Dreamweaver, but am unable to find a file where $SITE and all it's little buddies are defined to correspond with a file name ('about' = ("about.php"). Any help or advice is greatly appreciated. Myotch Hello again:] I am wondering where should i put valid doctype <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> and meta tags <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> in a php file like this. Code: [Select] <?php session_start(); // Session starts here if(!isset($_SESSION['username'])) // If there is no session then... { die ("<div align='center'><img src='images/LOGINKITTEN.jpg'/><br /><a href='index.php'><img src='images/Login.jpg'/></a></div>"); // ...Die! } $id = $_GET['id']; ?> <html> <head> <link rel="stylesheet" type="text/css" href="jamcss.css" /> </head> <body> <img src="images/jamspace.jpg" /> <div id="jamcontainer"> <b><a href="main.php">Home</a> || <a href="members.php">Members</a> || <a href="jams.php">Jams</a> || <a href="uploadjamform.php">Upload Jam</a> || <a href="myprofile.php">My profile</a> || <a href="about.php">About</a> || <a href="adminindex.php">Moderators</a> || <a href="logout.php">Logout</a></b> You are logged in as <?php echo $_SESSION['username']; ?> <br /><br /> <?php $connection = mysql_connect("lol.com", "loldb", "lol00") or die ("Could not connect"); mysql_select_db("loldb", $connection) or die("Could not connect"); // mysql query to get the username $query = mysql_query("SELECT * FROM news ORDER BY id DESC"); $numrows = mysql_num_rows($query); if ($numrows!=0) { // fetching data from the database to variable while ($row = mysql_fetch_assoc($query)) { $title = $row['title']; $post_owner = $row['post_owner']; $post = $row['post']; echo "<b>" . $title . "</b><br />"; echo "Posted by <b>" . $post_owner . "</b><br /><br />"; echo $post . "<hr></hr><br /><br />"; } } ?> </div> </body> </html> How would I redirect if the code is after the <head> tag? My code is a bit complicated and needs to go under my html code but wont redirect successfully because of <head>. I'm using Code: [Select] print("<meta http-equiv='Refresh' content='0;index.php' />"); to redirect. Hi all Recently designed a site using includes, but only realised when I'd almost finished the project that because the (e.g.) include("includes/header.html"); had the <head> information (titles, meta description, etc) every single page included the same information (by the way hope this makes sense) A way I thought of getting around this was to store each pages title and meta description in a database or in for example or maybe in a variables.php file. But I'm not sure whether this is the best way. I'm not a PHP expert so simple explainations would be very much appriciated. Look forward to hearing from you all. Adi Hi there. Having a little trouble getting Open Graph working with my facebook like button. I can put text in fine but I want the following variables to be represented in the head information so that I can edit the head data periodically. Would appreciate any help. I've tried "<?php echo $blahblah ?>" which doesn't seem to work. Confirmed that nothing was being pulled by Facebook's linter... Code: [Select] //Variable for Head. $id = '1'; $promo_id = $id; //Change this to be variable with function... $promo_title = "Goody Bag"; $promo_text = cms::string('copy.goody_bag.sub_title'); $promo_image = "/assets/images/goody_bag/goody_bag_small_bg.png";//Change this to be variable with function... $promo_description = cms::string('copy.goody_bag.text'); //These are to be put into the head information but will need to be made variable using either the controller or the iframe.php ?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <title></title> <meta property="og:title" content="Goody Bag"/> <meta property="og:type" content="website"/> <meta property="og:url" content="http://apps.facebook.com/ztoa_dev/like/show_like/1"/> <meta property="og:image" content="http://apps.facebook.com/ztoa_dev/assets/images/goody_bag/goody_bag_small_bg.png?2"/> <meta property="og:site_name" content="Z to A by Sunsilk"/> <meta property="fb:admins" content=""/> <meta property="og:description" content="Blah Blah Blah"/> </head> |