Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2012, 07:55:31 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155440 Posts in 21702 Topics by 7732 Members
Latest Member: Smacki
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Passing and using post variables in WB  (Read 747 times)
whitsey

Offline Offline

Posts: 22


« on: September 03, 2008, 01:28:54 AM »

Hi,

Hoping someone can help with this query.

1. I am passing some variables via the query string (?key1=value1&key2=value2) and want to know how I can use these within the WYSIWYG editor.  I just want to display a success message with the values that are passed.  How do I access these values from within WYSIWYG editor?

2. Is there a site constant variable that will easily identify to me what the parent page of the current page is? (see below)

Page 1
----- Page 1.1
----- Page 1.2
----- Page 1.3
Page 2
----- Page 2.1
----- Page 2.2
----- Page 2.3

From Page 1.1 how can I access the URL of Page 1 dynamically? (I want to pass it via a form value so that the resulting page has the "category page" that I just linked from to link back to) 
NOTE: I know I can achieve this manually but I have about 20+ pages to update which is a pain - I would like to figure out how to do it dynamically
Logged
BerndJM

Offline Offline

Posts: 1764



« Reply #1 on: September 03, 2008, 01:54:10 AM »

Hi,

for 1.)
you cannot use PHP Code in the WYSIWYG Editor. So you can not handle the variable you get per post.
But you can use a section type "code" above your WYSIWYG section and put the necessary code for handling you data in it and display it there.

for 2.)
please have a look at Variables and Constants on the help-pages. There you find, beside many others a constant called "PARENT" ...  shocked

Regards Bernd
Logged

In theory, there is no difference between theory and practice. But, in practice, there is.
whitsey

Offline Offline

Posts: 22


« Reply #2 on: September 03, 2008, 03:45:59 AM »

Thanks for that, much appreciated.

Now I can access these variables that is great however, how do I convert this into an on page link.

Page 1
----- Page 1.1
----- Page 1.2
----- Page 1.3
Page 2
----- Page 2.1
----- Page 2.2
----- Page 2.3
Page 3

i.e.
a) From Page 1.1 I can now retrieve PARENT.
b) I pass this to Page 3 as a variable and can access it from the query string
c) Now I want to use this ID to create a link on Page 3 to link back to the parent page(the category I just came from) i.e. Page 1

From Page
Logged
BerndJM

Offline Offline

Posts: 1764



« Reply #3 on: September 03, 2008, 04:24:33 AM »

Hi,
sorry if may sound a little stupid at this point - english isn't my natural language.
You could handle a.) and b.) did I understand that correct?
Your trouble now is on c.) ?

Regards Bernd
Logged

In theory, there is no difference between theory and practice. But, in practice, there is.
whitsey

Offline Offline

Posts: 22


« Reply #4 on: September 03, 2008, 04:28:39 AM »

Yes, apologies.  Your response answered questions a) & b) however it returned an ID instead of the page_url.  Now I need to convert the ID into a page_url to display as a link.

Thanks
Logged
BerndJM

Offline Offline

Posts: 1764



« Reply #5 on: September 03, 2008, 04:40:54 AM »

ok,
convert the ID (it's the parents ID - right?) into an URL for a backlink.
You need a additional database query at this moment, who looks for the ID (either the 'page_id' or the 'parent' or the 'root_parent' - depending on the case you want to realize) and reads there the 'link' - which points to the correct filename in the /pages directory.

Regards Bernd
Logged

In theory, there is no difference between theory and practice. But, in practice, there is.
whitsey

Offline Offline

Posts: 22


« Reply #6 on: September 03, 2008, 04:45:49 AM »

Thanks Bernd,

Does this mean I need to srcipt a db call or is there a function that exists to do this for me?
Logged
BerndJM

Offline Offline

Posts: 1764



« Reply #7 on: September 03, 2008, 04:55:13 AM »

Yes this means you have to script a appropriate db-query that fetches the required information.
At this point. the only available information you have is the id so you have to get the information you need from the database.

Regards Bernd
Logged

In theory, there is no difference between theory and practice. But, in practice, there is.
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!