Search

Hi Guys,

Wondering if anyone can help me out. I need to get a custom event to add a url parameter to two different pages from the same form submission.

I have two pages, the first (listings), the second (map).

The listings page shows a list of items, (their titles, descriptions etc.) There is a form on this page, which filters the items by category. This is working great. It runs on a custom event adding the chosen item category to a url parameter. The code is below;

<form method="post" action="">
<input type="checkbox" name="fields[area-category][]" value="food-and-drink"/>Food &amp; Drink<br/>
<input type="checkbox" name="fields[area-category][]" value="parks-and-gardens"/>Parks &amp; Gardens<br/>
<input name="action[submit-search]" type="submit" class="buttons" value="   Submit   " />

public function load(){

        if(isset($_POST['fields'])){

            foreach($_POST['fields'] as $name => $value){
                $_GET['fields'][$name] = $value;
            }
            unset ($_POST['fields']);

        }

        if(isset($_POST['action']['submit-search']))return $this->__trigger();

    }

    protected function __trigger(){

        $page = Frontend::instance()->Page();

        foreach($_GET['fields'] as $names => $values){
            $page->_param['url-'.$names] = $values;
        }

    }

The map page is an xml page of area latitude and longitudes that is taken by javascript to plot the points on a google map, which shows on the listings page. This works great too.

However I would like the points on the map to be filtered in the same way as the listings if possible (using the same form). The way I see it I need to add the url parameter to the map page in the trigger function above. But I can't work out if this is even possible.

Any advice would be gratefully received.

Thanks in advance

I dont understand you correct, maybe. you got /data/events/YOURCUTOMEVENT/post-values/ to filter out what you need. I d'nt think you need a additional url parameter..

hi thanks for the reply. I see what you mean about the post values. But I am still unsure as to how I can apply these post values to the second page (essentially a hidden xml page)? thanks again

but why don't you filter via xslt using the post values? It's late at night but tomorrow I can take a look at your problem.

hi thanks for your help, please let me try to explain what I mean a little more.

I have two pages, a normal page and an xml page. The form is on the normal page, the post values are taken and put into the url parameter so that I can filter the datasource linked to the normal page. This is working fine.

The second page (xml) also needs access to the same post values (url parameters) so that it's datasource can be filtered too. But I don't know how to do this bit as the form is not on the second page (and can't be added as its a hidden xml page that feeds the interactive map on the normal page)

I hope that makes sense, sorry it's just hard to explain what I mean! Essentially I am asking how can I access post values/set a url parameter for a specified page that the form action doesn't point to - I don't even know if this is possible?

Essentially I am asking how can I access post values/set a url parameter for a specified page that the form action doesn't point to

You have a form to filter something out of your db, serving a page fits the users needs.

on the other hand you have an hidden xml page, shuold be possible filtered too.

so becoause http is a stateless protokoll, I don't realize how the two filtered pages should bind together.

you can build links with GET values inside, you can store values in cookies but I do not understnad what you try to do or how your filterinfomation should be stored in a stateless proto.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details