Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Can one change the value of comment_submit and comment_preview
Or are we stuck with ‘Preview’ and ‘Submit’?
I’m building a blog in 2 languages and need to have buttons in italian too.
Offline
Re: Can one change the value of comment_submit and comment_preview
Can you not simply replace the Txp tags with the code like so:-
<input type="submit" value="Preview" name="preview" class="button" id="txpCommentPreview" />
<input type="submit" value="Submit" name="submit" class="button disabled" id="txpCommentSubmit" disabled="disabled" />
then change “value” to what you need? I should point out that I haven’t tried this myself so I am unsure what might happen with “disabled”.
Last edited by thebombsite (2010-04-28 15:20:54)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#3 2010-04-28 20:50:37
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Can one change the value of comment_submit and comment_preview
Two further ideas:
1. Try what happens if you dont use the value attribute for your submits? (see point 4 on the linked post) Test the page via an OS in another language/ask your Italian client.
2. Perhaps another use case for rah_replace in combination with smd_if and its if_urlvar attribute?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Can one change the value of comment_submit and comment_preview
I’ve gone with thebombsite’s suggestion but I can’t have submit buttoon disabled.
I’ve also gotten rid of the comment_remember as it spits out English.
These tags need name=”“ attributes :)
Offline
Re: Can one change the value of comment_submit and comment_preview
uli wrote:
2. Perhaps another use case for rah_replace in combination with smd_if and its if_urlvar attribute?
You mean something like wink wink ;)
<txp:rah_replace from='value="preview",value="Submit"' to='value="NewLabel",value="NewSubmit"'>
<txp:comment_preview />
<txp:comment_submit />
</txp:rah_replace>
That’s crazzzzyyyyy.
lozmatic wrote:
I’ve gone with thebombsite’s suggestion but I can’t have submit buttoon disabled.
Oh yes. If_comments_preview helps:
<input type="submit" value="Preview" name="preview" class="button" id="txpCommentPreview" />
<txp:if_comments_preview>
<input type="submit" value="Submit" name="submit" class="button" id="txpCommentSubmit" />
<txp:else />
<input type="submit" value="Submit" name="submit" class="button disabled" id="txpCommentSubmit" disabled="disabled" />
</txp:if_comments_preview>
Offline
Re: Can one change the value of comment_submit and comment_preview
I knew Jukka would have a plugin. ;)
It would be good to be able to change the “value” attribute via the tag or maybe it could be added to the language files though that would be less flexible.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: Can one change the value of comment_submit and comment_preview
thebombsite wrote:
It would be good to be able to change the “value” attribute via the tag or maybe it could be added to the language files though that would be less flexible.
Problem, or not really a problem, in that is that the the comment form tags actually are not TXP tags at all. The comment system is seperate from the actual core. While real tags call functions and return output, comment form’s tags are just replaced with strings. This is one of the reasons why comment system’s rewriting has been one of the on going topics for several years. Good thing is that changing the tags into tags isn’t really that hard job.
Offline
Re: Can one change the value of comment_submit and comment_preview
Gocom wrote:
Good thing is that changing the tags into tags isn’t really that hard job.
Fancy sending us a patch then? ;-) I went round in circles trying to do it.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Can one change the value of comment_submit and comment_preview
Bloke wrote:
Fancy sending us a patch then? ;-)
Won’t submit this as real patch, but the tow two (lol) functions would, or might, be something like following. You can use this if you like.
function comment_preview($atts,$thing=''){
extract(lAtts(array(
'value' => gTxt('preview'),
'id' => 'txpCommentPreview',
'class' => 'button'
),$atts));
if(!empty($thing))
$value = $thing;
return
fInput('submit', 'preview', $value, $class, '', '', '', '', $id, false)
;
}
function comment_submit($atts,$thing=''){
extract(lAtts(array(
'value' => gTxt('submit'),
'id' => 'txpCommentSubmit',
'class' => 'button'
),$atts));
if(!empty($thing))
$value = $thing;
if(ps('preview'))
return
fInput('submit', 'preview', $value, $class, '', '', '', '', $id, false)
;
return
fInput('submit', 'preview', $value, $class.' disabled', '', '', '', '', $id, true)
;
}
And then just requires removal of lines 194-195
from /publish/comments.php
. That is for those two tags, won’t be same for the rest :D Are you saing that I shouldn’t just pick two out of many ;-)
<txp:comment_submit>
Love containers.
</txp:comment_submit>
<txp:comment_preview>
Won't our whitespace make us succesfuly invalid?
</txp:comment_preview>
<txp:rah_function call="trim">
Yo, yep.
</txp:rah_function>
<txp:hide>
Stfu already Gocom.
</txp:hide>
I blame hyperactive mind.
Last edited by Gocom (2010-04-29 20:01:33)
Offline
Re: Can one change the value of comment_submit and comment_preview
Thanks Gocom, that works :)
Offline