Hello, I am experiencing a problem with custom and meta tags. If its joomla, or WP there are lot of plug ins. but for simple php website its really difficult. Is there anu suggestion for this.
So, you are facing problem in creating meta tags or inserting it? There are various websites which can provide you a free tool to get good meta tag and title for your website.
You can surely do in simple php. Create a database which has meta title and all. And write conditions in the header of every page and this will call the meta's from the database. Hope I solved your problem.
meta tag includes a lot of aspects. it starts from keyword, description and extend up to author, robot and many more. No third party language is capable of inserting all meta tags as per you need. The best way to do this is manually. Use text-editor or Dreamweaver or simply wordpad to editing it. You can also take help from w3school.
Manually editing meta and title of each page is difficult if its a large website. @Alan Smith : Can you explain the database creation and recalling them using the URL as the parameter. ie check URL and if the url is same with database URL put that set of meta and title. can u give me the php code for doing so.
Manual changes are better than automiatic software. Like people have to work for money, you have to work for SEO.
@ajuas in such a case also you have to put the meta tag in db so that your site can fetch it and you have to put the php code in each page for getting data from db. This will be the same as that of editing pages with dreamweaver. Just open the page you want to edit. INSERT->HTML->HEADTAG-> all meta attributes are there just put yours and the page will be automatically edited.
Well, here is something: The variable you need to use is $_GET which will call the parameter from url: index.php?name=my_name gives $_GET['name'] a value of my_name. If you are not using a database already on your website, I don't think you have a website big enough to actually benefit from using dynamic meta tags. If you are...well, there is plenty of ways to do this and with out seeing the actual code it's pretty hard to help. Never the less, let's try it out: Creating a database. If you use cPanel, you can just crate a database and a database user. Connect them and memorize the database name, username and the password. Yours script will need it. Then go to PHPMyAdmin. Select the database you just created and create a new table (there is an option for that) like mateinfo. Just create table with 4 columns. First name is id, type is INT and length is 11. Set it to Auto Increment and make it as a primary key. Second column would be called as a title. Varchar with length of 150 is good enough. Third is the description. Maybe type as a text and then fourth keywords as text too. Now your database is ready. Next create a file like db_fns.php. Inside that, do something like this: <?php $db_name = "DATABASE_NAME_HERE"; $db_host = "localhost"; $db_user = "DATABASE_USER_HERE"; $db_pass = "DATABASE_PASSWORD_HERE"; function db_connect() { $connect = mysql_connect($db_server,$db_user,$db_pass); if(!mysql_select_db($db_name, $connect)){ return false; } else { return $connect; } } function get_info($id) { db_connect(); $quesry = "SELECT * FROM " metainfo WHERE id = ".$id; $result = mysql_query($query); $row = mysql_fetch_array($row); return $row; } ?> Now, inside the file what will be generating the dynamic content, you need a following code. Well, at least based on this example. <?php include('db_fns.php'); $info = $get_info($_GET['id']); // Found from the url. At this point it's a number, but can be build with letters too. ?> <head> <title><?php echo $info['title']; ?></title> <meta name="description" content="<?php $info['description']; ?>" /> <meta name="keywords" content="<?php $info['keywords']; ?>" /> </head> Here you go. As I said. This can be done with many different ways and I'll bet you have some kind of db_connection already happening on your website. The code and some database structure is needed before a complete work can be done.
@sudip03 You are explaining about a single page, but i am asked about large e commerce website. For large e commerce website we have to create dynamic meta tags. @arkrose thanks for the php code. But we are using search engine friendly URLs, so i cant add an "index.php?name=my_name" my_name to URL. sometimes the url may be homepage.com/seo.html at this stage is there any option.
looks like you have not used CMS system? build a simple CMS system and this will resolve your problem.
Actually, you can. While SE friendly urls does look like a plain text, the url-parameters are there. Place to get them is a little different. You can't maybe get them through the url, but from the code it self. How is your urls constructed? What parameters does that code use? All you need to do is follow the same principles and you are done. Now, there is one certain scenario where you can't get any data from the url and that is when the url is pointing to an actual file. If that is the case...I don't think you can create any larger sites with that technique. Way too much work. So, do you use databases? How is your content generated?