what is a HTTP response code variant in Panels 3 Drupal - drupal-panels

Dear Friends.I am using Panels 3 in drupal 6.2.
While creating page panel i get the option variant type where i can either select panel or HTTP response Code.
My query is what is this HTTP response code option for.I tried to add a panel using this option but nothing seems like working.Please help me.
Thanks and Regars

Creating a page variant using a HTTP Response code allows you to redirect the display for the intended path to a 404 page not found, 403 Access denied, or 301 redirect. You would use the first two to keep a user from accessing a specific site display page or you could redirect them to another page that you choose.
If it is not working, check the defined path for the page definition, the position of the variant in the list (panels will display the first variant that meets the criteria), or the contexts you are applying to the page

Related

Send information from elementor form to another page with the modified data

I'm building a wordpress site with elementor pro.
I want to make a form (in which you enter some numerical data as metric cubes and other numbers) that redirects you to another page where that data is transformed. How can I do that?
maybe you can use a template with html javascript linked by an external link button
When redirecting to the other page (eg: site.com/other-page) you could include the "numerical data" as a Query String directly in the redirected URL (eg: site.com/other-page?data=1234). Then, upon initial loading of the other page, the data can be retrieved from the URL

wordpress delivers wrong page

Currently running WordPress 4.9.5 using the Divi theme with Permalinks set to use Post name, I can enter a url (page title/name) that does not exist on the site and WordPress will deliver a page that has the “filename” part of the url somewhere in the title/name of the page it delivers but is different than the actual url.
For example, if you go to http://space.nss.org/renew/
Instead of getting a 404, WordPress delivers the page http://space.nss.org/renewable-energy-partnership/
What on Earth is WordPress thinking?
What can I do to identify the exact nature of the problem and fix it?
Note that this behavior is not universal as I can enter bad urls (like space.nss.org/armstrong/) and do get the expected error page.
Thanks in advance, Jim.
NOTE: The url referenced above (space.nss.org/renew/) has now been fixed so its original behavior is no longer exhibited.
With respect to my problem, it turns out that Wordpress is just trying to help by assuming that humans do not know how to type.
When I type "space.nss.org/renew/" and Wordpress doesn't find an exact match, it looks for anything it can find containing the string "renew"
and delivers what it considers to be the best match as a way of avoiding delivering a 404 page to the visitor.
This feature can be turned off but there are consequences in that the 'redirect_canonical' is also responsible for resolving domain name issues (like www.domain.com vs domain.com). For reference, see https://codex.wordpress.org/Function_Reference/redirect_canonical
Following are references on the subject I found once I knew what I was looking for.
[https://wordpress.stackexchange.com/questions/3326/301-redirect-instead-of-404-when-url-is-a-prefix-of-a-post-or-page-name]
2
[https://serverfault.com/questions/776310/how-to-disable-the-automatic-redirection-in-wordpress-htaccess-file]
3
[http://biostall.com/prevent-wordpress-redirecting-to-nearest-matching-url/]
Looking at the network log it appears there is a 301 redirect placed on /renew to go to /renewable-energy-partnership
As a solution you could remove the redirect so that it goes to the 404 page instead.

If a page 'A' is opened, find out from which source page page 'A' has been called?

I am currently in "pageA.aspx". Using top.location.href or Response.Redirect(), I've come to "pageB.aspx". How to find out that which page has called "pageB.aspx". Is it "pageA.apsx" or any other page.
I aware of using URL Query-String. But I need to use any other option.
You can use Request.UrlReferrer.
Gets information about the URL of the client's previous request that
linked to the current URL.

How to load a different front page in drupal if a cookie is set?

I'm trying to figure out how i'd write a module or something so that drupal will show the user 1 front page. If a cookie is set, they see a different one.
So basically, I can't find the following even after googling.
where would I do this? A module? edit the theme file?
How do I show 1 page or another?
I'm using drupal 6 on a linux/apache.
Its unclear if you want to show a different styling or completely a different set of data on the front page in case the cookie is set.
If you want to show a different styling, Create two different template files. You can use theme_preprocess_page function where you can check for the cookie ans set the appropriate template file.
Use api.drupal.org to get the structure of the function. Also use krumo to check in which index of the array(var that goes as an arguement in page_preprocess function) is the template file is being loaded.
Hope this helps!!
I ended up just using PHP in the page_tpl.php
check if cookie is set
if not, load page 2 and set cookie
otherwise show page 1

Drupal: simple form forwarding data to another server

I need to add a page with a form in my Drupal website. This form should be submitted to another server (there is a php script ready to receive it on such server).
So, I don't need any database update, just a page forwarding the data inserted by users to another domain.
Do you know what's the easiest way to do it ?
thanks
ps. Also, I need to create a drop down menu with a list of countries (and regions for each country) as submenu
I am surprised noone mentioned hook_form_alter and setting #action to an external URL. This will make the form post directly to the other server if you have control of it you can easily redirect back. Lot easier than POSTing from your server. Another way would be to iframe the other script and use the target attribute (set $form['#attributes']['target'] = 'the_iframe' in hook_form_alter). Then you can use JS to 'move' the page after the submit. Upload POSTs to an iframe, you can look into that JS as well. How do you post to an iframe? discusses iframes and forms.
In your form, you can set #action to whatever URL you want. It will post to that url. If you need a GET, instead of a POST, you should also set the #method.
function my_form_builder() {
$form['search'] = array(
//..builds some form elements
);
$form[#action] = 'http://example.com';
return $form;
}
You could create a regular drupal form with the ususal validation stuff and instead of putting the date into the DB send it over to the other site (via post or get or whatever).
To POST to an external URL in your own custom form implementation or using hook_form_alter() to add another submit handler to an existing form, while not showing the request you will want to use drupal_http_request() to send a serverside http request. See this:
http://www.drupaler.co.uk/blog/validating-submitting-forms-other-websites-drupal/428
To accomplish this with the webform module you'll need what you learned above and something like the following:
In D6 /Webform < 3
http://drupal.org/node/543674#comment-2499674
In Drupal 7/Webform 3
http://www.midwesternmac.com/blogs/jeff-geerling/integrate-webform-3x-paypal

Resources