| | |
convert PHP to javascript?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
•
•
•
•
Under the reviews tab on your product pages, you have HTML. If this is custom HTML that you added through a form (maybe in the administration panel of your store), then you can have PHP do this automatically for you.
It could post the HTML for reviews through that form, to be saved for the product.
Some cool ideas bouncing around this thread tonight.
Last edited by langsor; Sep 5th, 2008 at 5:49 am.
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
It would probably be easiest to build a php review site on an external host and use a system of iframes to display each page in html formatting. I would happily make such a site for you as I make those type of sites all the time and soon I will even be making my own review site from scratch.
Also as a website host, checkout http://www.jumba.com.au/hosting/personal/
Also as a website host, checkout http://www.jumba.com.au/hosting/personal/
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
•
•
•
•
It would probably be easiest to build a php review site on an external host and use a system of iframes to display each page in html formatting. I would happily make such a site for you as I make those type of sites all the time and soon I will even be making my own review site from scratch.
<script type="text/javascript src="server_script.php?product_id=1"></script>
... and get the results back from PHP as javascript ... either way is simple really.
How do iFrame's content work with SEO?
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
If SEO (Search Engine Optimization) is what I think it is (I googled it), there are 2 ways of doing it. The easy way and the hard way with great results.
The easy way is just to have a page with iframes or as mentioned above javascript. But the hard way is to not only use iframes and javascript in the ways mentioned above, but to also use javascript to have variables in the url bar and those variables then go into the iframe locations. Although another method is to instead of iframes, to use something as follows.
And of course you would have the function geturlvars() defined at the beginning of the page. That information can be found at http://snipplr.com/view/799/get-url-variables/ but the code at that location will need heavily altering to return the url vars as one long string.
Sorry if the code isn't exact but that is from the top of my head.
So as you can see in the code box above, it imports the page from the other website and all links from the host with php link to the host without php (to the same file every time but different url vars) if you know what I mean.
Edit: To stop search engines double indexing the data a robots.txt on the server with php can block all search engines but search engines could still index from the main website.
The easy way is just to have a page with iframes or as mentioned above javascript. But the hard way is to not only use iframes and javascript in the ways mentioned above, but to also use javascript to have variables in the url bar and those variables then go into the iframe locations. Although another method is to instead of iframes, to use something as follows.
PHP Syntax (Toggle Plain Text)
<script type="text/javascript src="domain.com/index.php?"javascript:geturlvars()></script>
And of course you would have the function geturlvars() defined at the beginning of the page. That information can be found at http://snipplr.com/view/799/get-url-variables/ but the code at that location will need heavily altering to return the url vars as one long string.
Sorry if the code isn't exact but that is from the top of my head.
So as you can see in the code box above, it imports the page from the other website and all links from the host with php link to the host without php (to the same file every time but different url vars) if you know what I mean.
Edit: To stop search engines double indexing the data a robots.txt on the server with php can block all search engines but search engines could still index from the main website.
Last edited by cwarn23; Sep 5th, 2008 at 6:58 am. Reason: Added info
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Sorry about the double post but I couldn't find the edit button.
Below is the code which would go into the html page to read the php page.
Also replace the below with the domain of your website with php (but keep the www.)
So with the above code, you should be able to place together a php website with is viewed by a pure html/javascript website.
Below is the code which would go into the html page to read the php page.
html Syntax (Toggle Plain Text)
<html><head> <title>Review Website</title> <script>function geturlvars() { var vars = window.location.href.slice(window.location.href.indexOf('?') + 1); vars='http://www.yourdomain.com/index.php?'+vars; return vars; }</script> </head> <body bgcolor=#FFFFFF topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0> <script>document.write("<iframe border=0 FRAMEBORDER=0 scrolling=auto width=100% height=100% src='"+geturlvars()+"' name='topframe'></iframe>");</script> </body> </html>
Also replace the below with the domain of your website with php (but keep the www.)
PHP Syntax (Toggle Plain Text)
www.yourdomain.com
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
•
•
Join Date: Sep 2008
Posts: 14
Reputation:
Solved Threads: 0
And the search engines would be able to read these reviews?
to answer the question above, the information under the reviews tab was just generic info added by the developer so that we could see what it looked like. When I add a product, my form on my server, has no way of adding information to that review tab.
Another question I have is if I do what cwarn has suggested how does the script know which page that the review was added to, for example, if somebody reviews a motorola phone, on certain page, how does it differentiate that from say the samsung phone, on another page, because the script would be the same for each page would it not? Sorry if these questions are naive, really trying to learn.
to answer the question above, the information under the reviews tab was just generic info added by the developer so that we could see what it looked like. When I add a product, my form on my server, has no way of adding information to that review tab.
Another question I have is if I do what cwarn has suggested how does the script know which page that the review was added to, for example, if somebody reviews a motorola phone, on certain page, how does it differentiate that from say the samsung phone, on another page, because the script would be the same for each page would it not? Sorry if these questions are naive, really trying to learn.
Last edited by kozkay; Sep 6th, 2008 at 4:31 pm.
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
Back again, sorry it took me so long to respond but I've been very occupied with many other things lately.
In light of not being able to go with digital-ether's suggestion (http://www.daniweb.com/forums/thread144017.html#10), which makes the most sense to me so far, and not being to write to the html page directly with any server-side technology (PHP, ASP, SSI, etc) as per the ProStores website ...
From what I can discover, the answer is NO. The search engines could choose to read the content of the iFrames, but instead consider it content originating outside of your site, or at least not originating from the page it is displayed on.
Likewise, a JavaScript approach (generating the content dynamically after the page has loaded) will not be seen by the search engine crawlers-bots, at least not of this writing -- although I heard Google is now implementing indexing Flash content, so the JavaScript situation could change, you never know.
Here are some of the sources I received my opinion from ...
This website:
So the question is, is it worth using the rating/ranking system even though it might not help your SEO position for the pages it is relevant to?
If so, do you want to use an PHP/iFrame approach or a JavaScript/PHP approach?
And finally, might it be an alternative approach to set up some sort of a sub-site where the rating/ranking system either opens in a new window or does show up in an iFrame, but has link-backs to the relevant page on your site ... since search engines consider some inbound links of value to the ranking of the page they are pointing at. Since I am not an SEO specialist, I do not know if this would or could be of value in your situation, or if this could be a detriment in some way if the search engines think you are trying to trick the system in some way -- you will need to investigate this on your own if you like.
If you decide on an approach, and still need/want help on this, just post back here with where you want to go with this.
Hope it helps
•
•
•
•
... to answer the question above, the information under the reviews tab was just generic info added by the developer so that we could see what it looked like. When I add a product, my form on my server, has no way of adding information to that review tab. ...
http://ecommerce-resources.prostores...?w=php&x=0&y=0It looks like you are severely limited to not having any SEO with your rating/ranking system you plan to implement ...
What server-side scripting languages are supported? Unfortunately, ProStores does not support server-side scripting. This includes ASP, CGI, Perl, PHP, and server-side includes. MySQL is also not supported. However, you can use a client-side scripting language such as JavaScript.
From what I can discover, the answer is NO. The search engines could choose to read the content of the iFrames, but instead consider it content originating outside of your site, or at least not originating from the page it is displayed on.
Likewise, a JavaScript approach (generating the content dynamically after the page has loaded) will not be seen by the search engine crawlers-bots, at least not of this writing -- although I heard Google is now implementing indexing Flash content, so the JavaScript situation could change, you never know.
Here are some of the sources I received my opinion from ...
This website:
http://www.daniweb.com/forums/thread83969.htmlWebProWorld website:
http://www.webproworld.com/search-en...tml#post348653I found no evidence to refute the above claims that search engines might index the content, but will not include it in SEO rankings for the page that the framed content is displayed on.
The reason is that search engines tend to not follow links to iFrames or Frames, nor credit the containing page for the content within the frames. Thus, any content you put in frames essentially is wasted from an SEO perspective.
With Frames and FrameSets, where the whole page consists of frames, there is never any reason to use them if SEO is a consideration for the page. No content is there to index.
However, there may be cases where iFrames are OK for SEO (at least from the perspective of not hurting you). If the iFrame content is not important for SEO (no keywords, not your content, ads, etc), and your page otherwise has good SEO content that surrounds the iFrame, then an iFrame will not hurt you. What is important here is that the main part of your page have good content.
http://www.webproworld.com/search-en...tml#post348783
...If you want that content indexed, use other techniques as noted elsewhere in this string. If you don't care about the framed content, it really does not matter either way for search engines.
Additional random comments:
=============================================
A lot of the other posters are right, you should use robots.txt too tell search engines not to index the individual frames and use the Lynx Browser, available on Unix systems, to see what Google see's. This is the best advice I can give!!
Use site map or robots.txt to index or not-index relevant frame content.
If there are any links to the Iframe pages from sitemap or external website, then there are chances for getting indexed.
So the question is, is it worth using the rating/ranking system even though it might not help your SEO position for the pages it is relevant to?
If so, do you want to use an PHP/iFrame approach or a JavaScript/PHP approach?
And finally, might it be an alternative approach to set up some sort of a sub-site where the rating/ranking system either opens in a new window or does show up in an iFrame, but has link-backs to the relevant page on your site ... since search engines consider some inbound links of value to the ranking of the page they are pointing at. Since I am not an SEO specialist, I do not know if this would or could be of value in your situation, or if this could be a detriment in some way if the search engines think you are trying to trick the system in some way -- you will need to investigate this on your own if you like.
If you decide on an approach, and still need/want help on this, just post back here with where you want to go with this.
Hope it helps
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
•
•
•
•
And the search engines would be able to read these reviews?
to answer the question above, the information under the reviews tab was just generic info added by the developer so that we could see what it looked like. When I add a product, my form on my server, has no way of adding information to that review tab.
Another question I have is if I do what cwarn has suggested how does the script know which page that the review was added to, for example, if somebody reviews a motorola phone, on certain page, how does it differentiate that from say the samsung phone, on another page, because the script would be the same for each page would it not? Sorry if these questions are naive, really trying to learn.
NB: JavaScript has nothing to do with Java, they are two different languages.
So you'll need to look at having someone advise you on how to create a review script with JSP, or look for an existing solution, such as suggested earlier in the thread.
This is actually a lot easier then a JavaScript only solution. Using JavaScript in this case would mean that you have no other option, but if you're able to use Java, then thats by far the best way to go.
You can always use JavaScript on the browser side to give it a more dynamic interface.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Yes, the website is done with Java Server Pages. Therefore you do not need to use JavaScript (either way Java web developers do not really like to see it) and take it to next level with frameworks Struts, Hibernate or JSTL & EL, Java Server Faces. These are very powerful components in hands of experienced programmer.
PS: I hope that this is not final face of the site as it is missing a lot on various categories and search does not come up with best results.
PS: I like site design. Are you using RIA?
PS: I hope that this is not final face of the site as it is missing a lot on various categories and search does not come up with best results.
PS: I like site design. Are you using RIA?
Last edited by peter_budo; Sep 8th, 2008 at 8:35 pm.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- convert php function to ajax? (JavaScript / DHTML / AJAX)
- Coldfusion image upload w. javascript thumbnail preview (ColdFusion)
- link c++ with javascript/html (C++)
- <script language=\"javascript\"> Display problem with PHP & MYSQL (PHP)
- converting from javascript to HTML? (Java)
Other Threads in the PHP Forum
- Previous Thread: Problem with Radio Button error "[object HTMLInputElement]"
- Next Thread: check if email address is correct without sending email?
| Thread Tools | Search this Thread |
ajax apache api array back basic beginner binary broken cakephp checkbox class cms code computing cron curl database date delete display dynamic echo email error external file files filter folder form forms function functions gc_maxlifetime google host href htaccess html iframe image include insert integration ip java javascript joomla limit link login loop mail memmory memory menu mlm multiple mysql navigation oop parsing paypal pdf php problem query question radio random recursion regex remote script search server sessions sms snippet soap source space sql syntax system table thesishelp trouble tutorial update upload url validation validator variable video web xml youtube






