I'm new to the forum and new to web development, I have an ecommerce store on prostores and I recently purchased a PHP based 5 star review script for my website. I then gave it to my web developer to implement it and he came back to me saying that prostores doesnt support php, only javascript. Is there a way around this? or can I conver this php script to javascript?

Recommended Answers

All 32 Replies

Conversion from PHP to Javascript is impossible. That's kind of like converting a spaceship into spaghetti. They're different things entirely.

PHP is a server-side programming language meaning that the code is parsed by the server. The end-user will never see PHP. Javascript on the other hand (in most cases) is a client-side programming language meaning that the server does not parse the code, but the end-user's browser does. Each language is used for different things and usually work hand-in-hand. I'm certain that the software you purchased has bits of Javascript in it, but is PHP based.

The only suggestion I would have is to find a regular web host that offers support for PHP.

unfortunately it's too late for that at this point. Any suggestions on good amazon style review script that is javascript?

Member Avatar for langsor

You might find it difficult locating a script if you have no server-side technologies you can use for it. I noticed ProStores does not support any server-side technologies, including MySQL -- where might you expect to store these reviews you want on your site???

I can suggest that you seriously consider not getting yourself locked into a service that you might find very difficult to get out of if you need to expand or grow your business, and from the looks of it, offers very minimal features outside of their specialization. No matter what it looks like now, it will likely be easier to change course now than down the road after you've invested even more time and money into this.

If you have invested a ton of money having someone customize one of the templates or design themes and insist on sticking with this service, you could always consider getting a second hosting service that would host the other scripts you need -- it doesn't sound appealing but is a thought.

I wish you luck

So I could have another hosting service host the scripts? How does that work? I dont know if its okay to post links here but if you go to my site www.mavidot.com and check out a product page, you can see that I have an area ready to go for the review script. You're saying it's possible to host this script on another server and still have the added benefits of seo for my domain?

Although I don't know about converting the script but you may find downloading a review script written in Java would be your best option. You should try and ask if a particular script is compatible with your server before buying one though. So try looking for a Java applet review script at http://www.hotscripts.com/Java/Applications/index.html

Note it is Java, Not Javascript.

Member Avatar for langsor

Although I don't know about converting the script but you may find downloading a review script written in Java would be your best option. You should try and ask if a particular script is compatible with your server before buying one though. So try looking for a Java applet review script at http://www.hotscripts.com/Java/Applications/index.html

Note it is Java, Not Javascript.

OMG, I hate java with a live passion, but I think cwarn might be right here ... it makes sense really.

To answer your question above, I know I could use JavaScript to talk to PHP on a different server. In fact I just tested my idea to make sure I'm not talking out of my ear here.

It would very likely require some, if not a lot of, custom code though. You might be able to find a javascript interface that handles the rating system front-end. That goes with a PHP back-end that talks to the database and returns results based on a simple product-id methodology. In this case you could run the javascript on your main site, the php on the remote-secondary site and use a little javascript/php hand-rolled module to make the two talk.

That hand-built module would be cake to anybody who knows both languages and if the product you bought was written well in both javascript and php so the middle-ware person didn't have to deal with a ton of spaghetti code.

Mind you, this can NOT be done with Ajax (at this time in Ajax's history) since Ajax still does not support cross-site queries (last time I checked).

Let me know if you need more details -- do you understand both javascript and php?

Cheers

I understand neither.

Member Avatar for langsor

Hi again,

I would be happy to try and help, but I should probably be talking to your web developer so he/she will have a head start on knowing what I'm talking about ...

Let me know if I can help on this

Cheers

You're saying it's possible to host this script on another server and still have the added benefits of seo for my domain?

A side effect of using JavaScript is that it is that it is invisible to Search Engines. So the reviews would not be indexed by search engines.

If PHP was used, it would be visible to search engines, since PHP renders the reviews as HTML.

To answer your question above, I know I could use JavaScript to talk to PHP on a different server. In fact I just tested my idea to make sure I'm not talking out of my ear here.

It would very likely require some, if not a lot of, custom code though. You might be able to find a javascript interface that handles the rating system front-end. That goes with a PHP back-end that talks to the database and returns results based on a simple product-id methodology. In this case you could run the javascript on your main site, the php on the remote-secondary site and use a little javascript/php hand-rolled module to make the two talk.

It would likely be less work creating a JavaScript review system, that saves the reviews to a custom PHP script.
Creating a javascript interface for the review script you have may be more work depending on how well they separate the logic from the rendering of HTML.

---

A non-standard solution you could use it to have a PHP server save your reviews, but then have that PHP server save those reviews to your site as HTML.

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.

This would be search engine friendly.

It would require that the PHP server know your administration panel password however, or at least the minimum required access to post HTML under the reviews tab.

It is non-standard, and if your PHP server had a vulnerability it would allow someone to log into your online store also. So I'd be very careful in choosing such a solution - but this is probably the only option you have of getting search engine friendly reviews.

Member Avatar for langsor

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.

Brilliant idea -- and I really like that you are always thinking about security concerns too, but maybe I"m just paranoid.

Some cool ideas bouncing around this thread tonight.

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/

Member Avatar for langsor

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.

I was thinking either using an iframe or calling the php script dynamically with javascript DOM to dynamically write a js-include tag ...

<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?

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.

<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.

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.

<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.)

www.yourdomain.com

So with the above code, you should be able to place together a php website with is viewed by a pure html/javascript website.

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.


How do iFrame's content work with SEO?

I'm curious about this also.

Member Avatar for langsor

Back again, sorry it took me so long to respond but I've been very occupied with many other things lately.

... 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. ...

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 ...http://ecommerce-resources.prostores.com/search?w=php&x=0&y=0
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.

It looks like you are severely limited to not having any SEO with your rating/ranking system you plan to implement ...

And the search engines would be able to read these reviews? ...

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.html


WebProWorld website:http://www.webproworld.com/search-engine-optimization-forum/64743-iframes-search-engine-optimization.html#post348653
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-engine-optimization-forum/64743-iframes-search-engine-optimization.html#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.


I 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.

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

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.

It appear that your site is written in server side Java - probably JSP.

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.

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?

Well, what about building the review system in flash and using text documents as databases?

This is probably one of the more unorthodox suggestions I've ever had to give someone. :P

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?

Its far from finished. The layout will stay the same, some content will change but LOTS of product needs to be added and the categories still need to be updated, but what is RIA?

Well, what about building the review system in flash and using text documents as databases?

This is probably one of the more unorthodox suggestions I've ever had to give someone. :P

I wouldnt even know how to begin to do that and also would that provide the SEO benefits that I seek?

Member Avatar for langsor

I wouldnt even know how to begin to do that and also would that provide the SEO benefits that I seek?

That could be done -- I think -- and it might give the SEO benefits you're looking for too with Google indexing Flash content. http://www.google.com/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&q=google+indexing+flash+content&btnG=Google+Search

Personally I know I could figure out a Flash methodology -- if it's possible with AS2.0 -- but wouldn't come close to using Java (to each their own, I say) ... but why reinvent the wheel. You could still use a pre-existing review back-end and implement a Flash front-end which I'm almost certain is possible talking to server-side scripts, and that has the hope of being indexed by Google (but unlikely any other search engines anytime soon).

Well, what about building the review system in flash and using text documents as databases?

This is probably one of the more unorthodox suggestions I've ever had to give someone. :P

Overkill, waste of resources and time
kozkay already has good design, how ever if he wants to go with multimedia FLEX is better choice it is easier to integrate

That could be done -- I think -- and it might give the SEO benefits you're looking for too with Google indexing Flash content. http://www.google.com/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&q=google+indexing+flash+content&btnG=Google+Search

Personally I know I could figure out a Flash methodology -- if it's possible with AS2.0 -- but wouldn't come close to using Java (to each their own, I say) ... but why reinvent the wheel. You could still use a pre-existing review back-end and implement a Flash front-end which I'm almost certain is possible talking to server-side scripts, and that has the hope of being indexed by Google (but unlikely any other search engines anytime soon).

langsor check your pm

You guys have all been a great help, bouncing ideas back and fourth so from what I understand hosting the review script on a seperate server is the easiest way but gives me no seo benefits. Doing the flash implementation gives me SEO benefits but is much harder. Am I correct? did we go over other viable ways?

I see no reason why you looking at Flash, the programmer that is working on your website should be able to do it in Java, you just need to give him clear idea what you want...

Member Avatar for langsor

I see no reason why you looking at Flash, the programmer that is working on your website should be able to do it in Java, you just need to give him clear idea what you want...

When I decided to teach myself Java, I took a good look at it and changed my mind ...
To paraphrase a familiar line -- "I'm a designer not a coder baby."

Anyway
1. If your site is built on top of Java
2. If your developer knows Java
3. And if Java can modify the contents of the page before they are served up to the browser
-- then Java is probably your best choice

Keep me posted if I can help any more with the skill-set I have :-)

So I thought you guys said java is different than javascript??? haha no im even more lost, sorry.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.