Welcome to Makestation! We are a creative arts/indie discussion community — Your center for creative arts discussion, unleashed!
Please note that you must log in to participate in discussions on the forum. If you do not have an account, you can create one here. We hope you enjoy the forum!
Writing Sharks is a team of professional writers that provides 100% original, high-quality, plagiarism-free content. Our services include essay writing, research paper writing, term paper writing, academic writing help, and much more. Visit today to order your writing.
https://writingsharks.net/
I've done quite a few small CMS-style projects for university and for random purposes. Each time, we ended up having to theme the project and it was always easier to do so by separating the HTML from the PHP. Fortunately, there are many template engines available, but some are very tedious to implement and are not suitable for small projects.
Luckily, it's incredibly easy to do templates with no trouble whatsoever. This template engine is incredibly simple and can be added to your project in less than 5 minutes. I use it on every raw project I've ever done, and it's a great time-saver and makes our code much cleaner and easier to maintain.
I've included the template_engine.php file with this post. It's licenced under the GPL 2, but if you need a different license, please PM me!
1. Create a file called template_engine.php with the downloaded file attached here. Include (or require_once) this file into every file/page of your project (such as index.php, etc). You may want to use your require_once("template_engine.php") in your init or global.php instead, depending on how your project is structured.
2. Now, create a templates folder inside your project. This folder should be in your project root and will contain all HTML template files.
3. Instantiate the template engine in each of these pages, or in your init file. Use the following:
Code:
$templates = new template_engine();
4. Start setting template variables/tags in your code. These variables will be replaced with the values they are set to when the template engine outputs your page. For example, in your index.php, you could set variables like this:
Now, the [@some_variable] tag will be replaced by "1234" by the template engine when it's ready to parse. Likewise, [@username] will be replaced with "Steve". Create as many variables as you like.
5. Create your index.html template in your templates folder. Use something like the following:
As you can see, we've used our new template variables directly in the template file. These variables will be replaced by their corresponding values on the fly by the template engine.
6. Parse the template and echo it. This will process all template tags and will send the resulting page to the browser.
Code:
echo $template->parse("index");
And now, with a simple template engine and 5 minutes of implementation, you can abstract away all HTML from your PHP code. This allows you to completely refactor the style and hTML structure of your theme/page without changing any of your PHP files, and keeps the project much cleaner than it would be with interleaved HTML/PHP.
Simple template engines such as these are perfect for small projects, university/college assignments, etc.
Hope this helps! Feel free to use it in your own projects as needed.
More Information (click spoiler):
[spoiler]
Can I change a variable/tag after it's already been set? Yes! So long as you haven't parsed your template (sent it to the browser) yet, you can use the $templates->set function as many times as you need. It will overwrite the previous value of the tag with your new value.
How should I handle template headers/footers?
I recommend having a separate header.html and footer.html template. At the very beginning of your PHP page, parse these using the following:
Now, in your index.html template, you may use the header/footer tags as normal:
Code:
[@header]
<h1> My page content </h1>
[@footer]
This allows you to use the same header/footer template for all of your pages, preventing you from having to duplicate the HTML in every page of your website.
Can I use templates inside of templates?
Yes! In fact this is recommend and is standard practice for simple template engines such as these. See the example above on how to do this.
What about the license? Feel free to use this in your own projects, that's what it's for! I wouldn't have licensed this at all, but I don't want someone stealing it, saying they wrote it, and then licensing it under some restrictive license. If you need a different license, please PM me!
[/spoiler]
FluxBB is an extremely bare-bones, simplified forum software that takes away almost all bloat that could be conceived. It's so simple that the entire ModCP and ACP are combined into one page, but yet it works and it's easy, and it's quite refreshing really. Much less cluttered, which is nice.
I installed it to experiment today (was always fond of PunBB, Flux's upstream parent). It doesn't have many features, but the interface is extremely simple and clean and the ACP is extremely easy to use. It has a huge mod database for such a bare-bones software as well. Some of them look pretty interesting.
I would never use it personally. It's a little too simple for my tastes(which is the whole point of it really), but it's perhaps the most streamlined mainstream forum software on the internet. For forums that need simplicity, it's nice. And judging by the mods, it apparently is pretty popular.
That being said, the default theme is absolutely horrendous, but some people have come up with some nice ones.
Didn't think it would be this hard, but it was absolutely the right thing to do. He will be missed like no other. Poor cat was crying like a baby. Never heard a cat cry like that, but I found out what it was like on Sunday, and it wasn't a pretty sight.
We made the call to end his suffering the easiest way possible. He was obviously dying and in excrutiating pain (despite pain relievers and sedatives), so we decided this was the best thing we could do for him. The vet was shocked he was still alive when we arrived. FIP had been diagnosed too late for us to treat it. (By the way, if anyone knows someone whose pet is fighting FIP, have them contact me. I know of treatments that can cure it if it's caught early).
Seems cliche because we all lose pets we love, but this one was harder than usual. Poor thing was much too young to die, and he had a force of will to be reckoned with. He refused to let go, even in his final hours.
I figured I'd move on like usual, I've lost friends and family and it's been so much easier. But this particular time it hit me hard. I'm glad the vet let us be near him in his final hours (Covid restrictions usually restrict that), but it doesn't make it any more bearable.
Please make your selection or the Member of the Month for October 2020.
This vote is to recognize members for their contributions for the previous month. In this case, a user's contributions for the month of September lead to their nomination for the October Member of the Month.
The poll is anonymous, and no one will see your vote.
I tried Amazon Ultra HD Music today. I was quite pleasantly impressed. There was a HUGE difference in quality over normal services.
Granted, I'm somewhat of an audiophile. I have a fairly precise ear and can hear artifacts in most compression formats, but Spotify's 320kbps premium is one of the few lossy compression algorithms that is totally transparent to my ears. It sounds exactly like the CDs in every single perceptable way. (Ogg at 192kbps is very close as well).
So when I compared Spotify and Amazon Ultra HD side by side, I was shocked when I heard FAR better than CD quality audio. It was a landslide difference. It was so noticeable that it was like being colorblind your whole life and learning to see.
Truthfully, I wonder if it was actually the mastering job and not necessarily just the format. Because suddenly I could hear where instruments were coming from spatially so much better than just sounding muffled between my ears. I could hear extremely faint sounds clearly (rather than being muffled or blending in with other parts of the mix). Even on live recordings, very quiet clapping from even a single audience member or very slight nuances that I couldn't hear were now audible. And the keyboards and guitars sounded so much more clear.
I can't explain it. The human range of hearing tops out at 20 khz, and CDs (with a sample rate of 44.1khz) can reproduce 22.05 khz accurately (above the human range of hearing). Furthermore, CDs use 16 bit audio which is well known to be more than enough to have plenty of dynamic range. Going from 16 to 24 bits only allows already imperceptable noise to become even quieter. Usually the differences are imperceptable.
But somehow, when you take 96khz 24 bit audio and put them together on U-HD, everything sounds so much more spacious. It sounds less muffled, more nuanced, more detailed, and more alive. And scientifically that should be impossible, but it absolutely did sound noticeably better.
Perhaps it really was the mastering (production) and not necessarily the format itself. I honestly dont' know, but in any case, if you have decent headphones, I'd recommend trying it. You won't regret it.
I threw together a quick plugin last night to resolve a number of issues with "Authorization Mismatch Error" codes (or user login issues) on older MyBB themes. This is single-handedly one of the most popular problems MyBB users have when installing older themes, and previously, the only fix was to manually edit templates. This plugin will take care of these fixes automatically and should save administrators some time when installing older themes!
To run the patches, simply upload the plugin, activate, and you're done. The readme has information on how to patch additional themes after the patcher has been run initially.
IMPORTANT: This is a best-faith effort to patch as many old themes as possible. It cannot be guaranteed to work on every single theme. Please make a database backup before use! This is pre-release and is currently in testing, full release is coming soon.
I have around ~70GB of old music projects (Logic Pro X) sitting on my hard drive. Every single track is a 48khz/24 bit wav/aiff, meaning that some tracks are over 50% bigger than normal CD-Quality WAV files. These projects easily reach several gigabytes, especially as they near completion, and WAV files are very difficult to compress with traditional compression algorithms. I am in the process of saving them externally to free up space, so I began my search.
Surprisingly, 7-zip did a pretty good job of shrinking the projects by 20-30%, but that didn't do a lot of good for situations when I had a lot of duplicate files (bounces and alternative versions) that added bloat. LZMA can detect duplicate files, but it can only do so if they are very close to each other (within 16-64MB of each other, depending on the dictionary size/configuation).
I found a tool called ZPAQ for that. It's a command-line only tool and it's a bit obscure, but it relies on implementing several compression algorithms and determining which algorithm is best for each specific type of file. This allows it to do much better on raw audio files that are generally difficult to compress with standard zip/7z-style compression.
The results: On about 9.5GB of data, I shrunk it down to a mere 1.3GB. This was a whopping reduction. (7-zip got it down to about 5.95 GB, for comparison). On files without duplicates, ZPAQ generally saw about a 35% reduction, and a 30% reduction on standard 7z/LZMA (compared to 10-20% on standard ZIP). The differences were far less extreme, but still very impressive considering the difficult-to-compress nature of lossless audio.
That being said, I will likely continue to use the 7z format because it's far better supported and doesn't require command-line interfaces to extract/compress (storage is cheap anyway ). However, with such extreme reductions seen by ZPAQ, I may look into it a little more for the future.
I discovered this recently, and it's been interesting. I don't have unlimited data, so saving data on Spotify is a big deal for me. I didn't realize this, however: It's 24kbps (HE-AAC). Spotify normally uses Ogg Vorbis, so I'm surprised they dropped it to AAC for this, but the 24kbps is shocking, to say the least.
I took a listen, and it's absolutely amazing how good it sounds at such an abysmal bitrate. Make no mistake, I can definitely tell the difference from the higher quality ones (it sounds a little more reverb/echo-ish, especially when the drums come in), but it doesn't sound terrible by any means.
Sirius/SiriusXM/XMRadio receivers generally use VBR at around 30-44kbps and sound MUCH worse (especially the old Sirius-only radios, the newer XM and SiriusXM ones sound a little better), so I'm quite surprised.
I generally can hear the difference between an MP3 and the CD at anything about 160kbps and lower, or with AAC, I can hear the differences even between 256kbps and the CD (surprisingly, as AAC is a better format).I'm not even an audiophile (haha ), and can definitely hear artifacts in higher bitrates, so I was surprised at how good Spotify pulled it off at 24kbps.
Anyone else used low bit rate audio before? What were your experiences? It's more or less obsolete with the storage we have available now, but it's still amazing how well some of the more modern formats can pull this off.
It’s quite a welcome update in my opinion. Adds widgets and the new App Library, both of which are long overdue features that android had had had for around a decade. It’s also quite a bit faster and drains my battery less.