Provide zblog template_ Zblog topic_ Download and customization of wordpress templates

EMlog obtains the title link and other data of the specified classification through the classification ID

Tianxing Studio 2023-03-20 13:22 Emlog Tutorial fifty-eight 0 Comments


emlog The pro version has been released, emlog Application Center It's also online, but Emlog Tutorial Still so few.

Recently, I was struggling with one Emlog template When you need to obtain some data of the specified classification, you wrote a function after looking at the source code of the emlog program about obtaining SQL:

 //Get the classification of the specified id function tx_ get_ cate($id) { if (!$id) { return ''; } $db = MySql::getInstance(); $sql = $db->query("select * from " . DB_PREFIX . "sort where sid IN($id) ORDER BY pid ASC"); $list_ array = array(); while ($row = $db->fetch_array($sql)) { $list_ array[] = $row; } if(count($list_array) > 0){ return $list_ array[0]; }else{ return ''; } }

The above functions are placed in the "module. php" file of the theme, and then other Template File directly uses "tx"_ get_ Cat ('classification id ') ['sortname'] "to call the classification name.

Other available classified data:

Classification link: Url:: sort (tx_get_cate ('classification id ') ['sid']); This is slightly redundant. It is recommended to use "Url:: sort ('classification id ')" directly;

Category alias: tx_ get_ Cat ('classification id ') ['alias'];

classification describe :tx_ get_ Cat ('classification id ') ['description'];

Classification template: tx_ get_ Cat ('classification id ') ['template'];

Parent category id of the category: tx_ get_ Cat ('classification id ') ['pid'];

Sort No.: tx_ get_ Cat ('classification id ') ['taxis'];


Can't find a tutorial that can solve your problem?

You can try to search or ask questions directly online. We also provide charging technical support. If you need it, you can contact us online.

Online questions Online Service

Related recommendations

Cancel Reply welcome you Comment:

 Please fill in the verification code
  • Latest articles
  • Hot article ranking
  • Most Comments
Label aggregation
  • Sign in
  • Registered account Forgot your password?
  • register
  • Already have an account? Direct login Forgot your password?
  • Social account login