convert PHP to javascript?

Reply

Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: convert PHP to javascript?

 
0
  #11
Sep 5th, 2008
Originally Posted by digital-ether View Post
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.
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,480
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: convert PHP to javascript?

 
0
  #12
Sep 5th, 2008
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/
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: convert PHP to javascript?

 
0
  #13
Sep 5th, 2008
Originally Posted by cwarn23 View Post
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?
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,480
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: convert PHP to javascript?

 
0
  #14
Sep 5th, 2008
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.

  1. <script type="text/javascript src="domain.com/index.php?"javascript:geturlvars()></script>
  2.  

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
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,480
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: convert PHP to javascript?

 
0
  #15
Sep 5th, 2008
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.
  1. <html><head>
  2. <title>Review Website</title>
  3.  
  4. <script>function geturlvars()
  5. {
  6. var vars = window.location.href.slice(window.location.href.indexOf('?') + 1);
  7. vars='http://www.yourdomain.com/index.php?'+vars;
  8. return vars;
  9. }</script>
  10. </head>
  11.  
  12. <body bgcolor=#FFFFFF topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0>
  13. <script>document.write("<iframe border=0 FRAMEBORDER=0 scrolling=auto width=100% height=100% src='"+geturlvars()+"' name='topframe'></iframe>");</script>
  14.  
  15. </body>
  16.  
  17. </html>

Also replace the below with the domain of your website with php (but keep the www.)
  1. 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.
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 14
Reputation: kozkay is an unknown quantity at this point 
Solved Threads: 0
kozkay kozkay is offline Offline
Newbie Poster

Re: convert PHP to javascript?

 
0
  #16
Sep 6th, 2008
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.
Last edited by kozkay; Sep 6th, 2008 at 4:31 pm.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 14
Reputation: kozkay is an unknown quantity at this point 
Solved Threads: 0
kozkay kozkay is offline Offline
Newbie Poster

Re: convert PHP to javascript?

 
0
  #17
Sep 6th, 2008
Originally Posted by langsor View Post

How do iFrame's content work with SEO?
I'm curious about this also.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: convert PHP to javascript?

 
0
  #18
Sep 7th, 2008
Back again, sorry it took me so long to respond but I've been very occupied with many other things lately.

Originally Posted by kozkay View Post
... 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...?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 ...

Originally Posted by kozkay View Post
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-en...tml#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-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.

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
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,081
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: convert PHP to javascript?

 
0
  #19
Sep 8th, 2008
Originally Posted by kozkay View Post
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.
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!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,208
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 488
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: convert PHP to javascript?

 
-1
  #20
Sep 8th, 2008
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?
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC