The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Moving Languages to Database
#11
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
  Reply
#12
So how would I produce the languages on the actual page? The same way I currently do?
  Reply
#13
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.
  Reply
#14
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.
  Reply
#15
Anyone got any thoughts on this?
  Reply
#16
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.
  Reply
#17
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?
  Reply
#18
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!
  Reply
#19
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
  Reply
#20
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!
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)