The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
Moving Languages to Database - 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: Moving Languages to Database (/showthread.php?tid=368)

Pages: 1 2 3


Moving Languages to Database - mudmin - 11-29-2016

Form control is a bootstrap thing. It's just a css style. If you stick those two functions in your usersc/include custom functions file, you can see how it works by just putting...

Code:
<?php
Code:
$t = 'users';
Code:
$skip = ['id'];
Code:
generateForm($t,$id,$skip);
Code:
?>
And it will generate an entire form for you...note that it won't update the password thing hashing properly so don't edit that Smile



Moving Languages to Database - Brandin - 11-29-2016

So how would I produce the languages on the actual page? The same way I currently do?


Moving Languages to Database - mudmin - 11-29-2016

I'm saying that you make a column in the db for each individual field that needs language (fname, lname, etc) and when you edit them, you can edit them from the front end.

If you want, you could also do an insert instead of update and add multiple languages with this form.


Moving Languages to Database - Brandin - 02-05-2017

Hey,

Looking back at this now because this whole language file is getting tedious, I'm getting annoyed. Is there any way we can load a language database into the helpers section? My languages database will of course have the general base of ID, Name, Text, like the format of the languages file. So, can we run a query in the languages file that populates more languages so I can start doing modifications via a web app?

E.g. the query would run and supply this to the languages file:

"SYSTEM_ADDED" => "The system has been added!",

Thanks.


Moving Languages to Database - Brandin - 02-11-2017

Anyone got any thoughts on this?


Moving Languages to Database - mudmin - 02-11-2017

You could do several things. You could do fwrite (I think it's called) to write your language to typical language files or you could make one table per page in the db (call it the pagename without the php) and do all your language in there. Each user could have a language stored in the user table.


Moving Languages to Database - Brandin - 02-12-2017

Hey,

So I've made a file called customlang.php. My thought is using fwrite() on that to avoid screwing up the language.php file. Now, how can I use some kind of PHP include or require feature or something, to include these lang's in the language.php file without actually being in there?


Moving Languages to Database - Brandin - 02-13-2017

Although not in PDO format, here y'all go:

I added to the bottom of language.php:
https://hastebin.com/xijudipepa.php

My DB table:
https://hastebin.com/ilotugakay.sql

Basically I use my languages table for many things, including header and footers, notices, links, fulfilling splash pages, etc, so I left room for many different content sections, all that are text formatted so have no limit.

Please feel free to convert to PDO and post a solution in that method too!


Moving Languages to Database - Brandin - 02-13-2017

FYI, I have moved all of my languages into this DB, and everything works amazingly! I love it! Much easier then modifying the file every time!

Here is the DB Dump to do so. Alter your table to set ADDED to NULL and then back.
https://hastebin.com/ekajemizet.sql


Moving Languages to Database - Brandin - 07-18-2017

Hey guys,

I've finally come around to convert this to PDO (months later lol) and not having much success, here is the haste:
https://hastebin.com/anafuxuvut.php

I am getting an error:
Code:
Fatal error: Class 'DB' not found in /home/aircentralized/public_html/mydash/users/helpers/language.php on line 6

Thoughts on how to replicate this? I have no issues using init and $db on any other files that don't have the header and nav.

Thanks!