Element Link

Status
Not open for further replies.

alanparis

New Member
Hi, I need to connect the result of a table to the content of the component.
In the element id using the links.
Es. the result of the table from this link
www.mysite.com/76
where 76 are the id of the field of the table
I must get www.mysite.com/component/option, com_alberghi /task,detail/Itemid,/id,76
to add us the id (76 or other).

How can I do?
Thanks
 
Thanks Andre, excuse but I don't understand
It misses a part of the pathway.
I have need in the element link of table the path of the component for open the article with all the information

Now the path is www.mysite.com/76 (where 76 is variable id)
I need www.mysite.com/component/option,com_alberghi/task,detail/Itemid,/id,76

... is possible?
 
You could create a custom table template to do this:

make a copy of /components/com_fabrik/tmpl/table/standard.html

rename it to new.html

edit your table and select "new.html" for the table's template

Then edit new.html and replace it with a custom table template, details of how to make one are in the docs i think, but basically it would look something like:

Code:
<form action="{FABRIK_PAGEURL}" method="post" id="fabriktable" name="fabriktable">
<mos:tmpl name="show-add" type="simplecondition" requiredvars="showAdd=1">
	<span class="pagenav">
		<a href="{ADDRECORDLINK}">Add Listing</a>
	</span>
</mos:tmpl>
<mos:tmpl name="show-csv" type="simplecondition" requiredvars="showCSV=1">
	<span class="pagenav">
		<a href="{CSVLINK}">Export to CVS</a>
	</span>
</mos:tmpl>

<mos:tmpl name="show-rsslink" type="simplecondition" requiredvars="showRSS=1">
	<span class="pagenav">
		<a href="{RSSLINK}">Subscribe RSS</a>
	</span>
</mos:tmpl>

<mos:tmpl name="show-filters" type="simplecondition" requiredvars="showfilters=1">
	<table class="filtertable" style="float:right;width:200px;border:1px solid #cccccc;" cellpadding="5" cellspacing="0">
		<tr style="background-color:#cccccc;font-weight:bold;">
			<th colspan="2" style="text-align:left">Search:</th>
		</tr>	
		<mos:tmpl name="filters">
			<tr>
		 		<td>{NAME}</td>
		 		<td style="text-align:right;">{VALUE}</td>
		 	</tr>
		</mos:tmpl>	
		<tr>
			<td colspan="2" style="text-align:right;">
				<mos:tmpl name="filter-form" type="simplecondition" requiredvars="filterform=1">
					<input type="button" onclick="submitfabrikTable('filter')" class="button" value="Go" name="filter" />
			</mos:tmpl>
			</td>		
		</tr>
	</table>
</mos:tmpl>


	 <mos:tmpl name="named-groups" type="condition" conditionvar="rowcount">
		<mos:sub condition="0">
				{EMPTY_DATA_MSG} 
		</mos:sub>
<table>
<tr>
<th>Name</th>
<th>Link</th>
</tr>
		<mos:sub condition="__default">
			<mos:tmpl name="named-rows">
				<tr>
				   <td><mos:var name="jos_users.name" /></td>
				   <td><a href="[url]www.mysite.com/component/option,com_alberghi/task,detail/Itemid,/id,<mos:var[/url] name="jos_users.id" />">Link to component</a></td>
				</tr>
			</mos:tmpl>
		</mos:sub>
	</mos:tmpl>
</table>
	<div style="text-align:center;margin:auto;">
				{FABRIK_DELETEBUTTON}
				{FABRIK_PAGENAV}
			</div>
	<mos:tmpl name="hidden-fields">
		<input type="hidden" name="{NAME}" value="{VALUE}" id="{ID}" />
	</mos:tmpl>	
</form>
<mos:comment>
<mos:var name="fabrik_templatevars" />
</mos:comment>
 
hi Rob,
My test is failed! I have create the template new.html and the link to component run good but one error is the result to pagination.
error
pat-Notice: No cdata is allowed inside a template of type condition (cdata was found in named-groups) in table/new.html on line 59

Another error is in the filter table. Yhis don't word.
In attach A file you view the normal situation of the site
In the B file the template new.html in action

?? do you help me, thanks
alan
 

Attachments

  • A.jpg
    A.jpg
    81.5 KB · Views: 262
  • B.jpg_thumb
    8.9 KB · Views: 227
  • B.jpg
    B.jpg
    40.9 KB · Views: 234
  • A.jpg_thumb
    15.6 KB · Views: 230
I have solved the problem of filter. To access is possible only user Register?

This is the error to template new.html and images are post before:
pat-Notice: No cdata is allowed inside a template of type condition (cdata was found in named-groups) in table/new.html on line 58

Another problem is the pagination - I need the link near the row of respective id and all in layout template site.
Post my new.html for help me!
thanks, alan
 

Attachments

  • new.html
    3.9 KB · Views: 200
hi alan

Please post your template file, that error occurs when you put some html code between the start of a conditional template and the condition its testing for.
e.g.

Code:
 <mos:tmpl name="named-groups" type="condition" conditionvar="rowcount">
		hello
		<mos:sub condition="0">

will give you this error

but

Code:
 <mos:tmpl name="named-groups" type="condition" conditionvar="rowcount">
		<mos:sub condition="0">
		hello

wont
 
hi Rob,
this the template file. Help me to review the code?
There are two form action ... is incorrect ...
One for the link to component and one for the data ... ???
thanks
alan (confusion)
 

Attachments

  • new.html
    3.9 KB · Views: 220
try this:

Code:
<form action="{FABRIK_PAGEURL}" method="post" id="fabriktable" name="fabriktable">
<mos:tmpl name="show-add" type="simplecondition" requiredvars="showAdd=1">
	<span class="pagenav">
		<a href="{ADDRECORDLINK}">Add Listing</a>
	</span>
</mos:tmpl>
<mos:tmpl name="show-csv" type="simplecondition" requiredvars="showCSV=1">
	<span class="pagenav">
		<a href="{CSVLINK}">Export to CVS</a>
	</span>
</mos:tmpl>

<mos:tmpl name="show-rsslink" type="simplecondition" requiredvars="showRSS=1">
	<span class="pagenav">
		<a href="{RSSLINK}">Subscribe RSS</a>
	</span>
</mos:tmpl>

<mos:tmpl name="show-filters" type="simplecondition" requiredvars="showfilters=1">
	<table class="filtertable" style="float:right;width:200px;border:1px solid #cccccc;" cellpadding="5" cellspacing="0">
		<tr style="background-color:#cccccc;font-weight:bold;">
			<th colspan="2" style="text-align:left">Search:</th>
		</tr>	
		<mos:tmpl name="filters">
			<tr>
		 		<td>{NAME}</td>
		 		<td style="text-align:right;">{VALUE}</td>
		 	</tr>
		</mos:tmpl>	
		<tr>
			<td colspan="2" style="text-align:right;">
				<mos:tmpl name="filter-form" type="simplecondition" requiredvars="filterform=1">
					<input type="button" onclick="submitfabrikTable('filter')" class="button" value="Go" name="filter" />
			</mos:tmpl>
			</td>		
		</tr>
	
</mos:tmpl>
</table>
<mos:tmpl name="named-groups" type="condition" conditionvar="rowcount">
		<mos:sub condition="0">
				{EMPTY_DATA_MSG} 
		</mos:sub>
<table>
<tr>
<th>Name</th>
<th>Link</th>
</tr>
		<mos:sub condition="__default">
			<mos:tmpl name="named-rows">
				<tr>
				   <td><mos:var name="jos_users.name" /></td>
				   <td><a target="_blank" href="/dnn/component/option,com_alberghi/task,detail/Itemid,/id,<mos:var name="jos_alberghi.id" />">mostra</a></td>
				</tr>
			</mos:tmpl>
		</mos:sub>
	</mos:tmpl>
</table>
	<div style="text-align:center;margin:auto;">
				{FABRIK_DELETEBUTTON}
				{FABRIK_PAGENAV}
			</div>
	<mos:tmpl name="hidden-fields">
		<input type="hidden" name="{NAME}" value="{VALUE}" id="{ID}" />
	</mos:tmpl>	
</form>
<mos:comment>
<mos:var name="fabrik_templatevars" />
</mos:comment>

you had two copies of the template in the same file and

Code:
</table>
	</mos:tmpl>

rather than

Code:
	</mos:tmpl>
</table>

which was causing the error
 
Hi Rob, the test is failed.
This the error
pat-Notice: No cdata is allowed inside a template of type condition (cdata was found in named-groups) in table/new.html on line 57

and the image the situation in the layout! ???
They miss the data and it is everything in horizontal the link "mostra"
what can I do?

thanks, alan
 

Attachments

  • test.jpg_thumb
    12.9 KB · Views: 199
  • test.jpg
    test.jpg
    46.6 KB · Views: 216
try:

Code:
<form action="{FABRIK_PAGEURL}" method="post" id="fabriktable" name="fabriktable">
<mos:tmpl name="show-add" type="simplecondition" requiredvars="showAdd=1">
	<span class="pagenav">
		<a href="{ADDRECORDLINK}">Add Listing</a>
	</span>
</mos:tmpl>
<mos:tmpl name="show-csv" type="simplecondition" requiredvars="showCSV=1">
	<span class="pagenav">
		<a href="{CSVLINK}">Export to CVS</a>
	</span>
</mos:tmpl>

<mos:tmpl name="show-rsslink" type="simplecondition" requiredvars="showRSS=1">
	<span class="pagenav">
		<a href="{RSSLINK}">Subscribe RSS</a>
	</span>
</mos:tmpl>

<mos:tmpl name="show-filters" type="simplecondition" requiredvars="showfilters=1">
	<table class="filtertable" style="float:right;width:200px;border:1px solid #cccccc;" cellpadding="5" cellspacing="0">
		<tr style="background-color:#cccccc;font-weight:bold;">
			<th colspan="2" style="text-align:left">Search:</th>
		</tr>	
		<mos:tmpl name="filters">
			<tr>
		 		<td>{NAME}</td>
		 		<td style="text-align:right;">{VALUE}</td>
		 	</tr>
		</mos:tmpl>	
		<tr>
			<td colspan="2" style="text-align:right;">
				<mos:tmpl name="filter-form" type="simplecondition" requiredvars="filterform=1">
					<input type="button" onclick="submitfabrikTable('filter')" class="button" value="Go" name="filter" />
			</mos:tmpl>
			</td>		
		</tr>
	
</mos:tmpl>
</table>
<mos:tmpl name="named-groups" type="condition" conditionvar="rowcount">
		<mos:sub condition="0">
				{EMPTY_DATA_MSG} 
		</mos:sub>
		<mos:sub condition="__default">
			<table>
			<tr>
			<th>Name</th>
			<th>Link</th>
			</tr>
				<mos:tmpl name="named-rows">
					<tr>
					   <td><mos:var name="jos_users.name" /></td>
					   <td><a target="_blank" href="/dnn/component/option,com_alberghi/task,detail/Itemid,/id,<mos:var name="jos_alberghi.id" />">mostra</a></td>
					</tr>
				</mos:tmpl>
			</table>
		</mos:sub>
	</mos:tmpl>
	<div style="text-align:center;margin:auto;">
				{FABRIK_DELETEBUTTON}
				{FABRIK_PAGENAV}
			</div>
	<mos:tmpl name="hidden-fields">
		<input type="hidden" name="{NAME}" value="{VALUE}" id="{ID}" />
	</mos:tmpl>	
</form>
<mos:comment>
<mos:var name="fabrik_templatevars" />
</mos:comment>
 
Wuaooooooooo Rob, thanks, I'm happy you have solve my big problem.
Now I have only the question to center the table in the layout (in the image C see the result)... and understand what version fabrik to use (in other post wiht Andre e Joaquin I have required this)
I try to manage html code for center template! I fink, when is solved this, is very important for other user to comment the code of template new.html for personalize table to link component).

Thank you very much Rob!
alan
 

Attachments

  • C.jpg
    C.jpg
    37.5 KB · Views: 227
  • C.jpg_thumb
    15.5 KB · Views: 199
Re: Element Link (SOLVED)

Ok, I post the finish code and comment to insert data for personalize this template.
Link the data for view page of component

1) Create a new.html template
2) Copy into this code
Code:
<mos:comment>
@version 4.5.2
@package fabrik
@copyright (C) 2005 Rob Clayburn
@license [url]http://www.gnu.org/copyleft/gpl.html[/url] GNU/GPL
</mos:comment>
<h1>{LABEL}</h1>
<p>{INTRODUCTION}</p>

<form action="{FABRIK_PAGEURL}" method="post" id="fabriktable" name="fabriktable">
<mos:tmpl name="show-add" type="simplecondition" requiredvars="showAdd=1">
	<span class="pagenav">
		<a href="{ADDRECORDLINK}">Add Listing</a>
	</span>
</mos:tmpl>
<mos:tmpl name="show-csv" type="simplecondition" requiredvars="showCSV=1">
	<span class="pagenav">
		<a href="{CSVLINK}">Export to CVS</a>
	</span>
</mos:tmpl>

<mos:tmpl name="show-rsslink" type="simplecondition" requiredvars="showRSS=1">
	<span class="pagenav">
		<a href="{RSSLINK}">Subscribe RSS</a>
	</span>
</mos:tmpl>

<mos:tmpl name="show-filters" type="simplecondition" requiredvars="showfilters=1">
	<table class="filtertable" style="float:right;width:200px;border:1px solid #cccccc;" cellpadding="5" cellspacing="0">
		<tr style="background-color:#cccccc;font-weight:bold;">
			<th colspan="2" style="text-align:left">Search:</th>
		</tr>	
		<mos:tmpl name="filters">
			<tr>
		 		<td>{NAME}</td>
		 		<td style="text-align:right;">{VALUE}</td>
		 	</tr>
		</mos:tmpl>	
		<tr>
			<td colspan="2" style="text-align:right;">
				<mos:tmpl name="filter-form" type="simplecondition" requiredvars="filterform=1">
					<input type="button" onclick="submitfabrikTable('filter')" class="button" value="Go" name="filter" />
			</mos:tmpl>
			</td>		
		</tr>
</table>
</mos:tmpl>
<br style="clear:both;" />
<br />

<mos:tmpl name="named-groups" type="condition" conditionvar="rowcount">
		<mos:sub condition="0">
				{EMPTY_DATA_MSG} 
		</mos:sub>
		<mos:sub condition="__default">
			<table width="100%" style="width:100%;border:1px solid #cccccc;" cellpadding="5" cellspacing="0" class="mfDataTable">
			<tr style="background-color:#cccccc;font-weight:bold;">
			<th align="left">labelfieldname1</th>
			<th align="left">labelfieldname1</th>
			<th align="left">labelfieldname1</th>
			<th align="left">Link </th>
			</tr>
				<mos:tmpl name="named-rows">
					<tr>
					   <td><mos:var name="jos_tablename.fieldname1" /></td>
						 <td><mos:var name="jos_tablename.fieldname2" /></td>
						 <td><mos:var name="jos_tablename.fieldname3" /></td>
					   <td><a target="_blank" href="/pathtocomponents/id,<mos:var name="jos_tablename.id" />">Link</a></td>
					</tr>
				</mos:tmpl>
			</table>
		</mos:sub>
	</mos:tmpl>
	<div style="text-align:center;margin:auto;">
				{FABRIK_DELETEBUTTON}
				{FABRIK_PAGENAV}
			</div>
	<mos:tmpl name="hidden-fields">
		<input type="hidden" name="{NAME}" value="{VALUE}" id="{ID}" />
	</mos:tmpl>	
</form>
<mos:comment>
<mos:var name="fabrik_templatevars" />
</mos:comment>

at the code
<th align="left">labelfieldname1</th>
<th align="left">labelfieldname2</th>
<th align="left">labelfieldname3</th>
<th align="left">Link </th>

change for your LABEL

at the code
<td><mos:var name="jos_tablename.fieldname1" /></td>
<td><mos:var name="jos_tablename.fieldname2" /></td>
<td><mos:var name="jos_tablename.fieldname3" /></td>

change with your element of table

for this code
<td><a target="_blank" href="/pathtocomponents/id,<mos:var name="jos_tablename.id" />">Link</a></td>
copy your path to components
for id use the id element of your table
for tablename use your table of components

This link run in _blank page if you prefer display in same window delete target="_blank" in <a target="_blank" href...>
be Happy! I'm Happy!
alan
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top