The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.28 (Linux)
|
![]() |
Custom Page Title - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23) +--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26) +--- Thread: Custom Page Title (/showthread.php?tid=537) |
Custom Page Title - bitsoft - 04-22-2017 Hi, How can I have a custom page title per page? It is currently set from Code: usersc/includes/head_tags Custom Page Title - mudmin - 04-27-2017 Sorry for the slow response. It's been a crazy week. If you look in users/helpers/helpers.php one of the first functions is Code: function currentPage() { Code: $uri = $_SERVER['PHP_SELF']; Code: $path = explode('/', $uri); Code: $currentPage = end($path); Code: return $currentPage; Code: } So, basically what you could do is make a database table (page_titles) that has 3 columns id (int 11, auto incremented, primary key) page (varchar 255) title (text) So then you would write something along the lines of... Code: $cp = currentPage(); Code: $currentPageQ = $db->query("SELECT * FROM page_titles WHERE page = ?,"array($cp)); Code: $currentPage = $currentPageQ->first(); Then you can do your head tag by echoing Code: $currentPage->title; Hope that helps Custom Page Title - bitsoft - 04-28-2017 Thanks for your response, I'll try it out. Custom Page Title - eeverts - 10-03-2017 In header.php this code is found: Code: <title><?=$settings->site_name;?></title> The title kan be changed on the fly, without changing us files: <pre> Code: <script type="text/javascript"> Custom Page Title - karsen - 10-03-2017 That's a great workaround, thanks! We're nearing the end of work on version 4.3 and this feature will soon be built in, but this Javascript snippet will work until then. |