[PHP] $PHP_SELF in a template problem, I think ??
I run a small search engine and adding URL's is a bit of a pain so I thought I would try to make it easier. Looking around I found a PHP function called "get_meta_tags" which unsurprisingly, grabs the contents of varoius meta tags. I just want the "description" contents so I first made a standalone PHP page (http://www.yorkshire-search.co.uk/links/meta-tags.php3) which performs get_meta_tags and uses $PHP_SELF so output is displayed on a page with the same name. Check it out and you see that works fine (was a slight problem if no initial URL value set). However, the search engine uses HTML templates and that is where my problem is. Within the orginal form (add_form.html) was just HTML so I deleted that and put the above working code between tags to generate a form. WhenI uploaded it and then entered the page, the form displayed OK but when I press "generate meta tags" it refuses to output the results into the boxes. The search engine manual says you can place PHP code within templates as long as they are within tags so I am now at a bit of loss. This is the add_form.html template if anyone is interested. Add Link <%error_msg%> if ($action == "generate") { print "Insert the following HTML code between the tags of your site:"; print "\n"; print "\n"; if ($robots == "yes") { print "\n"; } if ($refresh == "yes") { print "\n"; } if ($copyright == "yes") { print "\n"; } if ($author == "yes") { print "\n"; } if ($generator == "yes") { print "\n"; } if ($language == "yes") { print "\n"; } if ($revisit == "yes") { print "\n"; } print ""; print "Create another set of meta tags"; } else { if (isset($getmetafrompage)) { $MetaTags = get_meta_tags($getmetafrompage); } $description = $MetaTags["description"]; $keywords = $MetaTags["keywords"]; $robot = $MetaTags["robot"]; $author = $MetaTags["author"]; $refresh = $MetaTags["refresh"]; $copyright = $MetaTags["copyright"]; $revisit = $MetaTags["revisit-after"]; $generator = $MetaTags["generator"]; $language = $MetaTags["language"]; $year = date('y'); print ""; print "If your page already has META tags you may import and edit them."; print "URL: http://\";>"; print ""; print ""; print ""; print " Title"; print "Url"; print "Description"; print ""; print "Category<%category%>Contact Name"; print "EmailBid"; print "(optional) "; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] $PHP_SELF in a template problem, I think ??
What I've said. I might just check out trying out as they aren't the brightest bunch of individuals. - Original Message - From: "Richard Baskett" <[EMAIL PROTECTED]> To: "Phil Latio" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, August 06, 2001 1:22 PM Subject: Re: [PHP] $PHP_SELF in a template problem, I think ?? > Does the manual actually say to use the tags ""? Or is it the > normal tags of ""? > .. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] $PHP_SELF in a template problem, I think ??
Tried this and got parsing errors so " must be correct. "Richard Baskett" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Does the manual actually say to use the tags ""? Or is it the > normal tags of ""? > > > I run a small search engine and adding URL's is a bit of a pain so I thought > > I would try to make it easier. Looking around I found a PHP function called > > "get_meta_tags" which unsurprisingly, grabs the contents of varoius meta > > tags. I just want the "description" contents so I first made a standalone > > PHP page (http://www.yorkshire-search.co.uk/links/meta-tags.php3) which > > performs get_meta_tags and uses $PHP_SELF so output is displayed on a page > > with the same name. Check it out and you see that works fine (was a slight > > problem if no initial URL value set). > > > > However, the search engine uses HTML templates and that is where my problem > > is. > > > > Within the orginal form (add_form.html) was just HTML so I deleted that and > > put the above working code between tags to generate a form. > > WhenI uploaded it and then entered the page, the form displayed OK but when > > I > > press "generate meta tags" it refuses to output the results into the boxes. > > The search engine manual says you can place PHP code within templates as > > long as they are within tags so I am now at a bit of loss. > > > > This is the add_form.html template if anyone is interested. > > > > Add Link > > > > > > > > > > <%error_msg%> > > > > > > > > > > if ($action == "generate") > > { > > print "Insert the following HTML code between the tags of > > your site:"; > > print " > CONTENT=\"$desc\">\n"; > > print "\n"; > > if ($robots == "yes") > > { > > print "\n"; > > } > > if ($refresh == "yes") > > { > > print "\n"; > > } > > if ($copyright == "yes") > > { > > print "\n"; > > } > > if ($author == "yes") > > { > > print "\n"; > > } > > if ($generator == "yes") > > { > > print "\n"; > > } > > if ($language == "yes") > > { > > print "\n"; > > } > > if ($revisit == "yes") > > { > > print "\n"; > > } > > print ""; > > print "Create another set of meta tags"; > > > > > > } > > else > > { > > if (isset($getmetafrompage)) > > { > > $MetaTags = get_meta_tags($getmetafrompage); > > } > > $description = $MetaTags["description"]; > > $keywords = $MetaTags["keywords"]; > > $robot = $MetaTags["robot"]; > > $author = $MetaTags["author"]; > > $refresh = $MetaTags["refresh"]; > > $copyright = $MetaTags["copyright"]; > > $revisit = $MetaTags["revisit-after"]; > > $generator = $MetaTags["generator"]; > > $language = $MetaTags["language"]; > > > > $year = date('y'); > > print ""; > > print "If your page already has META tags you may import and edit > > them."; > > print "URL: > VALUE=\"http://\";>"; > > print " > class=\"button\">"; > > > > print ""; > > print ""; > > print " > width=\"100%\"> > size=\"2\">Title"; > > print " > face=\"Arial\" size=\"2\">Url"; > > print " > echo=\"$getmetafrompage\"> > face=\"Arial\" size=\"2\">Description"; > > print " > wrap=virtual VALUE=\"$description\">"; > > print " > size=\"2\">Category > size=\"2\"><%category%> > size=\"2\">Contact Name"; > > print " > face=\"Arial\" size=\"2\">Email > size=30> > size=\"2\">Bid"; > > print " > color=\"green\">(optional) > type=submit name=submit value=\"Add\" > > class=\"button\">"; > > } > > > > > > > > > > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] What's the difference between echo and print?
What's the difference between echo and print? I believed they were the same. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Does $PHP_SELF work in templates?
Lets take the most simple of scripts and run it on a standalone page to prove it's working correctly before we import into a template file. http://www.yorkshire-search.co.uk/links/add_form.php4 Next step, lets change the tags to because that's what it says in the manual and put it into the add_form.html template and see if it runs now. http://www.yorkshire-search.co.uk/links/add.php3 Oh dear boys and girls, it doesn't work and poor old Phil is starting to cry. I know, let's play a game and see if we can cheer him up by finding out why the below code doesn't work and of course, you can play along at home too. { $MetaTags = get_meta_tags("$getmetafrompage/",1); { $description = $MetaTags["description"]; } print ""; print "If your page already has META tags you may import and edit them."; print "URL: http://\";>"; print ""; echo "<%error_msg%>"; echo ""; echo ""; echo ""; echo "$description"; echo ""; echo ""; echo ""; } This is my attempt at humour if anyone was wondering !! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Put value directly into form?
How can I directly put values into a form instead having to create hidden fields and drag the data from them? You can see what I mean at: http://www.yorkshire-search.co.uk/links/add.php3 Would a javascipt function be any use to me? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Put value directly into form?
> http://www.yorkshire-search.co.uk/links/add.php3 Right, I seem to have not made myself too clear so I'll try again. Originally, the page "add.php3" was using a plain HTML template called "add_form.html" which consisted of a simple form. If you click on the link above and have a look at the page, everything below Add Link was how it started off. In the code below, it's everything after the tag. Users would just complete the form and press submit. However, I decided instead of typing in certain fields, I wanted to autofill the boxes so I found a PHP4 script which would grab meta-tags and embedded it into the template. All PHP scripts have to be within tags as defined in a different part of the search engine script. My problem is that whatever method I have tried, I have not managed autofil the forms text boxes with values from the script in a one step process. I first tried putting the HTML form in the script but this brought parsing errors. Next I tried keeping the form in the HTML but trying to use value= statement. This again brought parsing errors or the code simply appeared in the box. Hope that makes a bit more sense. // Include the function so you can use it later in the page require('metaengine.php'); // Call the MetaEngine function and assign the return value to an array $metaInfo = MetaEngine($url); // Array index is not numbers but names, such as: // $metaInfo[title] is the title of the page // $metaInfo[description] is the description of the page // $metaInfo[keywords] is the keywords of the page echo " Sample Enter URL: 1. Press the submit button and it will grab meta tags of website. 2. If complete URL displays in box below, press the above button. "; Add Link <%error_msg%> Url Title Description <%description%> Category <%category%> Contact Name Email Bid (optional) Once you are happy with your entries, press this button. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]