disable adding of <p></p> tags in fckeditor - fckeditor

how to disable automatic adding of <p></p> tags in Fckeditor.
When i try to get any post data from fckeditor, it gives me the data wrapped in
how do i remove/disable those <p></p>
Thanks in advance for any suggestions and reply

Too late, but will help others reaching this page via search engines, like I found it.
<?php
include_once('fckeditor/fckeditor.php');
$oFCKeditor = new FCKeditor('description');
$oFCKeditor->BasePath = '/fckeditor/';
$oFCKeditor->Value = 'some text';
$oFCKeditor->Config['EnterMode'] = 'br'; // turn off auto <p> tags wrapping content
$oFCKeditor->Create();
?>
Refer http://www.tequilafish.com/2008/09/12/fckeditor-remove-p-tags-from-wrapping-your-content/

Adding to the previous answer, If you're using ColdFusion rich text area (which used fckeditor), you can disable the <p> tags by setting EnterMode to br in fckconfig.js

Related

How to include a checkbox image in a Qweb Report?

Is there way to change checkbox image in qweb report. For example i want to change standard "V" to image like this:
Is it possible?
Solution 0
Add the file to your module, for example store it in the path /module_name/static/src/img/image_name.png
Then now you can add the image to the Qweb Report:
<img t-att-src="'/module_name/static/src/img/image_name.png'" />
Note: respect the order and the type of the quotes
Solution 1
Maybe it is useful to create ul html list with all the elements you want to add:
<style>
.icon_list {
list-style-image: url('/module_name/static/src/img/image_name.png');
}
</style>
<!-- [...] -->
<ul class="icon_list" >
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
(I didn´t try it but it should work as well)
you can simply replace it with the standard Unicode character ☑ by a field that is checking the status
Please use "input type as checkbox". It worked for me.
<input type="checkbox" checked="checked"/>I agree that glasses are selected based on my indications
in odoo11
you can choose this class for checkbox
i class="fa fa-check which opening and closing tags This gives better checkbox than default in odoo

How to read a text when it is not in any HTML tag

How can I find text in following HTML:
style="background-color: transparent;">
<-a hre f="/">Home<-/ a>
<-a id="brea dcrumbs-790" class=" main active mainactive" href="/products">Products<-/a>
<-a href="/products/fruit-and-creme-curds">Fruit & Crème Curds<-/a>
Crème Banana Curd
<-/li>
<-/ul>"
</div>
This is HTML for Bread Crumb, first three are link and fourth is page name. I want to read page name (Crème Banana Curd) from Bread crumb. But since this is not in any node so how to catch it
If the text isn't present inside any tag, then it is present in body tag:-
So you can use something like below to identify it:-
html/body/text()
Though the question seems to be vague without a proper HTML source but still you may try the solution below by storing the Text in a Variable-
var breadcrumb = FindElement(By.XPath(".//*[#id='brea dcrumbs-790']/following-sibling::a")).Text;
use the below code:
WebElement elem = driver.findElement(By.xpath("//*[contains(text(),'Crème Banana Curd')]"));
elem.getText();
hope this will help you.

facebook comment system using smarty and prestashop

I'm trying to add some comments box to a specific page of my website
but I met some trouble
using smarty I've seen in the documentation that in order to get the current url we should use that synthax {$smarty.server.HTTP_HOST}{$smarty.server.REQUEST_URI}
that's actualy what I did putting that code in my tpl.
{literal}
<div id="fcbcfooter"><div data-href="http://{$smarty.server.HTTP_HOST}
{$smarty.server.HTTP_HOST}{$smarty.server.REQUEST_URI}" class="fb-
comments" data-width="500px;" data-num-posts="10" data-
colorscheme="light"></div>
{/literal}
The trouble I have is that it return to me that message
href URL is not properly formatted
The code for getting url does not seems to be interpreted in the source code.
anykind of help will be much appreciated.
You are missing a closing </div> at the end of your code block right before the {/literal} tag.
{literal}
<div id="fcbcfooter">
<div data-href="http://{/literal}{$smarty.server.HTTP_HOST}
{$smarty.server.HTTP_HOST}{$smarty.server.REQUEST_URI}{literal}" class="fb-comments" data-width="500px;" data-num-posts="10" data-colorscheme="light"></div>
</div>
{/literal}

dijit.InlineEditBox with highlighted html

I have some dijit.InlineEditBox widgets and now I need to add some search highlighting over them, so I return the results with a span with class="highlight" over the matched words. The resulting code looks like this :
<div id="title_514141" data-dojo-type="dijit.InlineEditBox"
data-dojo-props="editor:\'dijit.form.TextBox\', onFocus:titles.save_old_value,
onChange:titles.save_inline, renderAsHtml:true">Twenty Thousand Leagues <span
class="highlight">Under</span> the Sea</div>
This looks as expected, however, when I start editing the title the added span shows up. How can I make the editor remove the span added so only the text remains ?
In this particular case the titles of the books have no html in them, so some kind of full tag stripping should work, but it would be nice to find a solution (in case of short description field with a dijit.Editor widget perhaps) where the existing html is left in place and only the highlighting span is removed.
Also, if you can suggest a better way to do this (inline editing and word highlighting) please let me know.
Thank you !
How will this affect your displayed content in the editor? It rather depends on the contents you allow into the field - you will need a rich-text editor (huge footprint) to handle html correctly.
These RegExp's will trim away XML tags
this.value = this.displayNode.innerHTML.replace(/<[^>]*>/, " ").replace(/<\/[^>]*>/, '');
Here's a running example of the below code: fiddle
<div id="title_514141" data-dojo-type="dijit.InlineEditBox"
data-dojo-props="editor:\'dijit.form.TextBox\', onFocus:titles.save_old_value,
onChange:titles.save_inline, renderAsHtml:true">Twenty Thousand Leagues <span
class="highlight">Under</span> the Sea
<script type="dojo/method" event="onFocus">
this.value = this.displayNode.innerHTML.
replace(/<[^>]*>/, " ").
replace(/<\/[^>]*>/, '');
this.inherited(arguments);
</script>
</div>
The renderAsHtml attribute only trims 'off one layer', so embedded HTML will still be html afaik. With the above you should be able to 1) override the onFocus handling, 2) set the editable value yourself and 3) call 'old' onFocus method.
Alternatively (as seeing you have allready set 'titles.save_*' in props, use dojo/connect instead of dojo/method - but you need to get there first, sort of say.

CSS locator for corresponding xpath for selenium

The some part of the html of the webpage which I'm testing looks like this
<div id="twoWideCallouts">
<div class="callout">
<a target="_blank" href="http://facebook.com">Facebook</a>
</div>
<div class="callout last">
<a target="_blank" href="http://youtube.com">Youtube</a>
</div>
I've to check using selenium that when I click on text, the URL opened is the same that is given in href and not error page.
Using Xpath I've written the following command
//i is iterator
selenium.getAttribute("//div[contains(#class, 'callout')]["+i+"]/a/#href")
However, this is very slow and for some of the links doesn't work. By reading many answers and comments on this site I've come to know that CSS loactors are faster and cleaner to maintain so I wrote it again as
css = div:contains(callout)
Firstly, I'm not able to reach to the anchor tag.
Secondly, This page can have any number of div where id = callout. Using xpathcount i can get the count of this, and I'll be iterating on that count and performing the href check. How can something similar be done using CSS locator?
Any help would be appreciated.
EDIT
I can click on the link using the locator css=div.callout a, but when I try to read the href value using String str = "css=div.callout a[href]";
selenium.getAttribute(str);. I get the Error - element not found. Console description is given below.
19:12:33.968 INFO - Command request: getAttribute[css=div.callout a[href], ] on session
19:12:33.993 INFO - Got result: ERROR: Element css=div.callout a[href not found on session
I tried to get the href attribute using xpath like this
"xpath=(//div[contains(#class, 'callout')])["+1+"]/a/#href" and it worked fine.
Please tell me what should be the corresponding CSS locator for this.
It should be -
css = div:contains(callout)
Did you notice ":" instead of "." you used?
For CSSCount this might help -
http://www.eviltester.com/index.php/2010/03/13/a-simple-getcsscount-helper-method-for-use-with-selenium-rc/
#
On a different note, did you see proposal of new selenium site on area 51 - http://area51.stackexchange.com/proposals/4693/selenium.
#
To read the sttribute I used css=div.callout a#href and it worked. The problem was with use of square brackets around attribute name.
For the first part of your question, anchor your identifier on the hyperlink:
css=a[href=http://youtube.com]
For achieving a count of elements in the DOM, based on CSS selectors, here's an excellent article.