add logic for page guide template JS and PHP