The downside is that I have to shoehorn the code into CMSms and sometimes it doesn't all play well together.
Now a tricky bit is the forms. The ThemeForest themes have great forms but they usually require very specific multiple classes, id's, placeholder text etc.
And CMSms generates most form inputs from the core, so classes, id's and other attributes are fixed.
So this is how I bend them to my will:
This is what I did with the Self Registration 'Registration Template 1'.
1) I added this:
Code: Select all
{$controls|@print_r}
This prints out an array of all the controls, this is the first one - email address as username:
Code: Select all
[username] => stdClass Object (
[color] => blue
[marker] => *
[required] => 1
[prompt] => Email Address
[name] => username
[control] => <input id="mc4758sr_input_username" class="cms_textfield" type="text" maxlength="40" size="40" value="" name="mc4758sr_input_username">
)
Code: Select all
<label for="txt_email">
<input id="txt_email" class="txt fill-width" type="email" placeholder="Enter your e-mail address"/>
</label>
3) Next I took the Self Reg default input and the ThemeForest theme input and put them together.
Code: Select all
<input id="mc4758sr_input_username" class="cms_textfield" type="text" maxlength="40" size="40" value="" name="mc4758sr_input_username">
<label for="txt_email">
<input id="txt_email" class="txt fill-width" type="email" placeholder="Enter your e-mail address"/>
</label>
4) So this is where Smarty does its magic. Smarty can use 'replace' to replace arrays. With this I built a Smarty find & replace.
I set up the 'find' variable with the things I wanted replaced.
Then the 'replace' variable with the values from the ThemeForest theme form input.
Finally I inserted a separate named control (plus find & replace vars) into its appropriate input field in the ThemeForest theme code.
Code: Select all
{assign var=find value=['cms_textfield', 'size="40"']}
{assign var=replace value=['txt fill-width', 'placeholder="Enter your e-mail address"']}
{$username->control|replace:$find:$replace}
Code: Select all
<div class="form-action">
<label for="mc4758sr_input_fullname">
{assign var=find value=['cms_textfield', 'size="80"']}
{assign var=replace value=['txt fill-width', 'placeholder="Enter full name"']}
{$fullname->control|replace:$find:$replace}
</label>
<div class="wrap-2col clearfix">
<div class="col">
<label for="mc4758sr_input_username">
{assign var=find value=['cms_textfield', 'size="40"']}
{assign var=replace value=['txt fill-width', 'placeholder="Enter your e-mail address"']}
{$username->control|replace:$find:$replace}
</label>
<label for="mc4758sr_input_username_again">
{assign var=find value=['cms_textfield', 'size="40"']}
{assign var=replace value=['txt fill-width', 'placeholder="Re-enter your e-mail adress"']}
{$username_again->control|replace:$find:$replace}
</label>
</div>
Code: Select all
<div class="form-action">
<label for="mc4758sr_input_fullname">
<input type="text" class="txt fill-width" name="mc4758sr_input_fullname" id="mc4758sr_input_fullname" value="" placeholder="Enter full name" maxlength="255" />
</label>
<div class="wrap-2col clearfix">
<div class="col">
<label for="mc4758sr_input_username">
<input type="text" class="txt fill-width" name="mc4758sr_input_username" id="mc4758sr_input_username" value="" placeholder="Enter your e-mail address" maxlength="40" />
</label>
<label for="mc4758sr_input_username_again">
<input type="text" class="txt fill-width" name="mc4758sr_input_username_again" id="mc4758sr_input_username_again" value="" placeholder="Re-enter your e-mail adress" maxlength="40" />
</label>
</div>
This is the Submit input generated by Self Reg default template:
Code: Select all
<input class="cms_submit" name="mc4758sr_submit" id="mc4758sr_submit" value="Submit" type="submit" />
Code: Select all
<button class="btn btn-red btn-submit" type="submit">Register</button>
Code: Select all
<button id="mc4758sr_submit" class="btn btn-red btn-submit" type="submit" name="mc4758sr_submit">Register</button>
Hope this helps somebody.
Simon66