1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to make changes in template through my custom add on

Discussion in 'XenForo Development Discussions' started by arpitjain, Aug 2, 2013.

  1. arpitjain

    arpitjain Member

    i have created a add on to display views a resource has gotten its working but i have to put this code in template for views
    <dl><dt>{xen:phrase views}:</dt> <dd>{xen:number $resource.viewcount}</dd></dl>

    i want to use following code with my add on ...how it is possible

    <modification template="TEMPLATE_NAME" modification_key="ADDON_NAME" description="ADDON_
    DESCRIPTION" execution_order="1" enabled="1" action="callback">
    <find></find>
    <replace></replace>
    </modification>
     
  2. Mike

    Mike XenForo Developer Staff Member

    You should simply create the necessary template modification via the control panel. Associate it with your add-on and it will be exported with your XML.
     
    bousaid likes this.
  3. arpitjain

    arpitjain Member

    thanks for replying Mike....
     
  4. arpitjain

    arpitjain Member

    after making changes i have assigned template resource_list_item or other templates to my add on but whenever i uninstall my add on ....it make my resource page blank ..that's why i need to replace code of template rather then assigning it to add on ...please reply .
     
  5. Jeremy

    Jeremy XenForo Moderator Staff Member

    You don't reassign templates. What Mike said is correct. In debug mode you'll see a link in the left hand column under "Appearance" that says "Template Modifications."

    Use that.
     
  6. arpitjain

    arpitjain Member

    i have created for to templates forum_list and resource_list_item for my add on they are working...but change make for resource_index template through TMS not working for my addon...i can save the changes but cant see on my page ...
     
  7. Jeremy

    Jeremy XenForo Moderator Staff Member

    Were they applied (green number on the TM index)?
     
  8. arpitjain

    arpitjain Member

    0/2/0 green is zero...why
     
  9. Jeremy

    Jeremy XenForo Moderator Staff Member

    The failed to apply for some reason. Check you find value.
     

Share This Page