Topic: New xajax site from Mexico PurasGangas.com

Hello guys,

  We have been working on this site for long time and now we are almost finish.

http://www.purasgangas.com/

  Any feedback is welcome and appreciated.

Tengan un buen d

Re: New xajax site from Mexico PurasGangas.com

Hi,

Looks very nice and very much in the spirit of AJAX/XAJAX. Well done. smile

Looking at the page source it appears that you have almost 30 registered functions.

When I find this happening I like to create what I call a "dispatcher" in the PHP code. This function is the only registered function and takes 2 parameters; The first being the form data and the second being an "op code" telling the dispatcher what it is to call on.

The function instances a global xajaxRresponse() object and does an if or a switch to decide which function to call based on the op code. The called function references the global response object, does its thing and returns. The dispatch function then returns the global response object.

The diapatcher liiks something like this:

...
function MyDispatcher($data, $op)
{
  global $resp = new xajaxResponse();

  if ($op == 'f1') 
    FunctionFor_f1();
 else if ($op == 'f2')
   FunctionFor_f2();
 ...
 else
   $resp->alert('Dispatcher called with invalid op code:' .$op);

 return $resp;
}

I don't really know if this is widely used way of handling the case where there are a lot of different options but it works well for me.

Again your site looks very nice.

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: New xajax site from Mexico PurasGangas.com

jaimehg wrote:

...
We have been working on this site for long time and now we are almost finish.
...
Any feedback is welcome and appreciated.
...

Nice work!  The site layout is clean and easy to navigate.  It is also quite responsive.

Only (very minor) issue I encountered is this:  when viewing the new item list, I scrolled to the bottom, then clicked on the last item.  Since the browser window had been scrolled, the product picture and description was off the top of the window.  You may want to scroll the window back to the top when navigating to a product page (or at least to the top of the product section **).  Otherwise, it worked great!

// Joe

**  I was able to do this by setting the href of the link being clicked to '#label' where label is defined on the page at the top of the section... see delayEvents.php in the xajax /tests/suite folder.

xajax Developer
Connect to me on LinkedIn:
http://www.linkedin.com/in/calledtoconstruct

Re: New xajax site from Mexico PurasGangas.com

Thanks for your comments, I was thinking that if I continue growing the site, the javascript in the main page could take long size due to the xajax javascript functions. Dispatcher could be a good way to solve that, but the problem is that I use a variable number of parameters in the javascript/php functions. I'll try to figure out how to integrate parameters in the dispatcher, maybe has arrays.

Thanks,
Jaime

Re: New xajax site from Mexico PurasGangas.com

CtC wrote:
jaimehg wrote:

...
We have been working on this site for long time and now we are almost finish.
...
Any feedback is welcome and appreciated.
...

Nice work!  The site layout is clean and easy to navigate.  It is also quite responsive.

Only (very minor) issue I encountered is this:  when viewing the new item list, I scrolled to the bottom, then clicked on the last item.  Since the browser window had been scrolled, the product picture and description was off the top of the window.  You may want to scroll the window back to the top when navigating to a product page (or at least to the top of the product section **).  Otherwise, it worked great!

// Joe

**  I was able to do this by setting the href of the link being clicked to '#label' where label is defined on the page at the top of the section... see delayEvents.php in the xajax /tests/suite folder.

Nice observation, I'll modify that functionality. big_smile

Thank you very much