I got a plug-in in Wordpress, where i have a shortcode [foobar] which outputs a form.
If i put the shortcode [foobar] inside a page in wordpress, the output shows as it should, e.g.:
<form>
<input></input>
</form>
If i put the shortcode inside a table like so:
<table>
<tr>
<td> [foobar] </td>
</tr>
</table>
Then the output is as two elements:
<form>
<input></input>
</form>
<table>
<tr>
<td> </td>
</tr>
</table>
The table is empty, and the output is displayed before the table, even though the shortcode is placed within the td element.
I tried putting the shortcode within a <div> tag, but same result - the shortcode is displayed before the <div> tag, and the <div></div> turns out empty.
I have no idea why this happens, maybe it is some kind of error within wordpress?
If any further information is needed, please let me know. I will gladly post the code, however i am not sure it has any relevance.
If you're going to execute a shortcode in your php page you have to do it with php as so:
<td><?php echo do_shortcode('[foobar]'); ?></td>
Give that a shot.
If you're doing this from the WP dashboard... it's because the shortcode itself has styles applied to it that will need to be adjusted to fit where you want to place it.
Do an inspect element on the shortcode as it prints on the page and see the styles that are associated with the shortcode and override or otherwise adjust them in your CSS.
Related
I have created a table inside my template, using the Mediawiki programming language as explained in the documentation. In the table cells are an image and a text. Now I would like to make the whole table clickable, so that it links to a different page. To do this I use the wiki syntax and define the page, where the user should get referred. Then using the Pipe-character, I set the table code instead of a standard text.
Unfortunately, only the table gets displayed, while the source code of the Link syntax gets print out as a text. Is there a fix you can recommend me?
Or at least something temporary?
Here is my wiki source code:
[[:Category:{{{1|}}} Products|
{|
|[[File:Apple.png|50px|left|link=]]
|Order our apples
|}]]
This should be the html code it should generate:
<a href="http://example.com/Category:Apple_Products">
<table>
<tbody>
<tr>
<td>
<div class="floatleft">
<img src="http://example.com/Apple.png">
</div>
</td>
<td>
Order our apples
</td>
</tr>
</tbody>
</table>
</a>
(I also tried adding the following instead of the Link syntax:
<a href="http://example.com/</nowiki>{{#replace:{{{1|}}}| |_}}_Songs">
It did not work, because the parsing caused a conversion of ">" and "<" characters..
I have a problem when using UI tags (ex: <s:select />) in Struts.
I use the default theme in a form (theme='xhtml')
CASE 1
When using
<s:select label="FIELD1" ....../>
Struts2 will generate the HTML code shown below (I skipped the non-important portions)
<table>
<tr>
<td>FIELD1:</td>
<td> <select ...... > </td>
</tr>
</table>
CASE2
When using
<s:select label='' .....>
the generated HTML code is shown below:
<table>
<tr>
<td>:</td>
<td> <select ...... > </td>
</tr>
</table>
In the HTML code generated by Struts2, you still see a colon in the label field in table.
CASE3
When using
<s:select .....>
If I do not use a label attribute, Struts2 will generate the HTML code shown below:
<table>
<tr>
<td></td>
<td> <select ...... > </td>
</tr>
</table>
In the HTML code generated by Struts2, you will see the label text is completely empty.
What I wish is, I set the attribute label='', and the label text in the HTML code generated by Struts2 is empty (no colon).
How do I do this?
Use the labelSeparator attribute to empty string and your requirement would be satisfied. Please refer the document for other attribute references for <s:select>:
http://struts.apache.org/2.x/docs/select.html
This is due to the xhtml theme which you are using and based on that Struts2 tags are generating the HTML output for you.
here is what happening inside Struts2 free marker template which is being used to generate the HTML output.
${parameters.labelseparator?default(":")?html}<#t/>
so what happening when you have no labelseparator it is using default seperator which Struts2 internally using :
So either you should provide labelSeparator as said by James and for better control of the output use simple theme and defined/design page as per your choice.
If you create following HTML below:
<table>
<tr>
<td></td>
<td>Last1</td>
<SPAN><FONT>test1</FONT></SPAN>
</tr>
</table>
and check DOM model you will see that IE(maybe others) create tag with no-name.
Here is link to screenshot Screenshot:
Are there any possibility to get access to this tag or not ?
Your HTML is invalid.
You can only put <td> and <th> elements directly inside <tr>s.
The browser is creating this tag in an attempt to fix your broken markup.
You should correct your HTML.
I've run into a curious problem; I've got a form inside a <tr>, however the form refuses to wrap any tags inside it. I've made a quick JSFiddle here to play around with. Firebug reports that the form isn't wrapping anything:
The <form> element is greyed out and not wrapping anything. The HTML for this test is below
<table>
<form>
<tr>
<td>Input</td>
<td>Another input</td>
</tr>
<tr>
<td colspan="4"><span>Other stuff</span></td>
</tr>
</form>
<tr>
<td>
Rows not affected by the form
</td>
</tr>
<tr>
<td>
Rows not affected by the form
</td>
</tr>
</table>
As can be seen, the form holds two trs in the written markup. I read here that this is invalid, so my question is can I create a form that holds two or more trs and an arbitrary amount of other elements inside a table? The table has other rows in it not associated with the form, so putting a <form> round the entire table is unhelpful, although seeing as the other rows won't have any inputs for the form (POST request), I suppose a form could be put around the entire table.
Which is a better solution; whole-table wrap, or a working fix for just enclosing the needed rows in a form tag? I know I could put a table inside a td > form, but then the column widths wouldn't be the same in the nested table, which is why I came to ask this question.
You cannot interrupt the <table> structure with any tags besides <thead>, <tfoot>, <tbody>, <tr>, <th>, or <td>. You form tags need to be encapsulated between two <td> or your entire <table> needs to be placed within the <form> tag.
<table>
<tr>
<td>
<form>
...form data...
</form>
</td>
</tr>
</table>
..or..
<form>
<table>
...
</table>
</form>
you can only put a form inside a td basically, so you could put those 2 rows inside a new table that you create inside a td
like ...
<table><tr><td><form><table><tr>...</tr><tr>...</tr></table></form></td></tr><tr>...</tr><tr>...</tr></table>
The <form> tag can only be placed inside a <td> element or outside the <table> in this case.
If I were you, I'd just put the <form> around the whole table since you said there won't be any other forms within it.
Or, you could replace the <table> completely with <div>s instead that use display: table; or display: table-cell;.
Is there a way to grab things out of the source code of another site directly into your site?
For example, let's say than in a site the following source code exists:
<table ...>
<tr>
<td class=...>...</div></td>
</tr>
<tr>
<td class=....><div align="... class=...>"Interesting string that keeps changing"</div></td>
</tr>
</table>
And we want that Interesting string that keeps changing to appear in our website as well.
you could use php
you use
$html = file_get_contents('url to website');
or use a hidden if you want a javascript function, and then just grab the innerhtml