WeStandWithUkraine

1279 Posts
Bucklash
6 years ago
12
Topic

Hi sebloders

Is it possible to load a form and select the override depending on the url of the site..?
ie if my-site.com/blog => load the contact form with {position override: override-1}
ie if mysite.com/articles => load the contact form with {position override: override-2}

Any ideas?

Thanks 

Bucklash

Get a Book for SEBLOD
310 Posts
ricco
6 years ago
3
Level 1

Hi,

The override file is only 1 eg mainbody.php, I don't think you can get different file eg mainbody2.php.

You could try this plugin to show different fields depending of the URL:

http://www.seblod.com/store/extensions/21190

I haven't tested it.

Regards,

ricco

1279 Posts
Bucklash
6 years ago
2
Level 2

Hi

Yeah, I thought it was a long shot. Would be sweet though

I think your suggestion is the way to go. Cheers for suggestion

Bucklash

1279 Posts
Bucklash
6 years ago
1
Level 3

Hi again

The other thought is placing the form in a SEBLOD Form Module, and arranging the fields that way,.

I can create "my_template/html/mod_cck_form/customlayout.php" and arrange the divs etc that surround the form, but I don't know how to arrange the fields within the form itself...

It might be that I'm trying to work against the flow, so the url plugin you mentioned is the 'good way'

hmmm

Bucklash

1279 Posts
Bucklash
6 years ago
0
Level 4

Hi Again

I have not tested this but I reckon I could add a beforerender field and apply the layout that way.

Will test when have had a go and report back.

 

Bucklash

310 Posts
ricco
6 years ago
1
Level 1

What is the final goal? Sorry, I can't understand.

1279 Posts
Bucklash
6 years ago
0
Level 2

Hi Ricco

Final goal is be able to have multiple instances of the same form, each with a distinct and separate layout, ie one instance being accordian style, another being a modal popup, and another being multi-stage etc
With content you can create many search and list types, each of these can have it's own layout.
With the forms, you have admin and site, you can create variations for that form and only apply one.
I could, in a single template file and with if statements, control the layout that way (which might be the way ultimately) though not sure how to do it based on value from url. I imagine it's easy once you know how...  
I wondered if I could control the layout another way for each instance of the form. If I could control the fields layout in a module override then that would be cool.

Bucklash

310 Posts
ricco
6 years ago
3
Level 1

Hi Bucklash,

You are talking like you are talking to yourself. Please give me examples, where did you see this? Any URL as example please?

The admin form is for you or your employs in the backend and it follows your front end or its a bit more complicated, so its not important currently.

What I understand from your question is: you want to have multiple instances of the same form on 1 page and create multiple variations of it but apply only one to it. That sounds very disinherit, but interesting, really.

I'd like to help you in this, keep me informed please.

Regards,
ricco

1279 Posts
Bucklash
6 years ago
2
Level 2

Hi Ricco

To the point: Can you create a module override (ie template/html/mod_cck_form/my-override.php) and control the layout of fields with in it?

Bucklash

310 Posts
ricco
6 years ago
1
Level 3

Please try and tell us what happened.

1279 Posts
Bucklash
6 years ago
0
Level 4

Hi Ricco

Nothings happened as such.

Original question: "can you load a seblod form module, and depending on the url, load a position or variation override?"

And another question is "Can you create a module override (ie template/html/mod_cck_form/my-override.php) and control the layout of fields with in it?"

Bucklash

4229 Posts
Kadministrator
6 years ago
1
Level 1

Hi,

module override will override modules own template modules\mod_cck_form\tmpl\default.php, but this is not what you would like to do I presume.

But nothing stops you form loading child overrides in the positon override depending on the url values, e.g. if you urls come from different menus, you can do

$itemId = JFactory::getApplication()->input->getInt('Itemid');

if ($itemId == 999)

{

include_once 'somefile.php';

}

else

{ include_once 'someotherfile.php'; }

1279 Posts
Bucklash
6 years ago
0
Level 2

Hi Klas

Thanks for that, that is what I'm looking for.

Excellent 

Bucklash

Get a VIP membership