Dedecms get the directory link URL for the current section of the document
DEDECMS content page calls the current column is actually used is not called out, {dede:field.typename/} is valid, but {dede:field.typeurl/} does not make the document current column directory link URL. Check the next online there are users to provide a solution, paste out everyone to share:
Method One:
{dede:type typeid= ' 0′row=1} [Field:typelink/] {/dede:type}
Method Two:
To modify the function, using the interface file of the Dedecms custom function, the markup in the article page
{Dede:field.typeid function= ' Typeurl_arc (@me) '/}
This is put in the template of the content page, put the following function:
function Typeurl_arc ($typeid) {
$typeurl = ";
$dsql = new Dedesql (false);
$row = $dsql->getone ("Select Typedir from Dede_arctype where id= $typeid");
$typeurl = Mftypedir ($row [' Typedir ']);
return $typeurl;
}
Put it in the extend.func.php.
Note: Mftypedir is a built-in function for the DEDECMS system
Dedecms method to get the current document URL address
{Dede:field name= ' Arcurl '/}
====================================================================================
Code function: Parent column and sub-column call simultaneously
Instructions for use ... Typeid,row
If [field:typedir/] contains {cmspath} and the link is invalid, use [Field:typedir function= ' Str_replace ("{Cmspath}", "", @me) '/] This label replaces [field: typedir/].
{Dede:field name= ' typedir ' runphp= ' yes '}
@me =str_replace ("{Cmspath}", "", @me);
{/dede:field}
Online collection of column call code:
First, tertiary column call
{dede:channelartlist Typeid=top row=4}
<div class= "CPMLL" >
<span><a href= "{dede:field name= ' typeurl '/}" >{dede:field name= ' TypeName '/}</a></span>
<ul>
{dede:sql sql= ' Select * from Dede_arctype where reid=~id~ ORDER by ID limit 0,7 '}
<li><a href= ' [field:typedir/] ' target= ' _blank ' >[field:typename/]</a></li>
{/dede:sql}
</ul>
</div>
{/dede:channelartlist}
Main column Call
{dede:channelartlist typeid=top row= '}
<li><a href= "{dede:field name= ' typeurl '/}" >{dede:field name= ' TypeName '/}</a>
<ul>
{dede:sql sql= ' Select * from Dede_arctype where reid=~id~ ORDER by ID limit 0,7 '}
[Field:array runphp= ' yes '] @me = (!empty (@me [' Reid '])? "": "<li><a href= ' {@me [' Typedir ']} ' target= ' _blank ' >{@me [' TypeName ']}</a></li> '); [/field:array]
{/dede:sql}
</ul>
</li>
{/dede:channelartlist}
Call top-Level column name method on list page and content page
{Dede:field.typeid runphp= ' yes ' function= "Gettopid (@me)"}
$dsql = new Dedesql (false);
$a = "Select TypeName from Dede_arctype where [email protected]";
$arcRow = $dsql->getone ($a);
@me = $arcRow [TypeName]; {/dede:field.typeid}
SQL statement to get top-level column names from sub-columns
{Dede:field.typeid runphp= ' yes '}
$ID = @me;
$sql = "SELECT * from ' dede_arctype ' WHERE id= $ID";
$query = mysql_query ($sql);
$row =mysql_fetch_array ($query);
$relID = "$row [Reid]";
if ($relID = = 0)
{
@me = $row [TypeName];
}
Else
{
$sql = "Select ' TypeName ' from ' Dede_arctype ' WHERE id= $relID";
$query = mysql_query ($sql);
$row =mysql_fetch_array ($query);
@me = $row [TypeName];
}
{/dede:field.typeid}
How to call Dede sub-column on homepage
{dede:channel type= ' son ' typeid= ' column ID '}
<a href= "[field:typelink/]" >[field:typename/]</a>
{/dede:channel}
Detailed dedecms various forms of column call tags, including SQL call method