The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

2 Pages V < 1 2  
Reply to this topicStart new topic
> Overlay Menu help required. (Creating Submenus)
pandy
post Feb 10 2023, 11:01 PM
Post #21


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



QUOTE(Christian J @ Feb 11 2023, 02:40 AM) *

(You can also make PHP run in files with ".html" extensions, by using a .htaccess directive --your webhost's support should provide specific details. Unfortunately the exact value of this directive may need to be changed every time the server's PHP version is updated.)


How stupid. Great way to complicate things. Is there a good reason for this?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Jason Knight
post Feb 11 2023, 01:30 AM
Post #22


Advanced Member
****

Group: Members
Posts: 100
Joined: 25-December 22
Member No.: 28,719



QUOTE(Midwinter @ Feb 10 2023, 08:15 AM) *

Do you have any suggestions into where I might find a working example at all,

Remember me saying somewhere else I had something I was working on I thought you'd like?

Well, here it is: Three part series I just wrote on medium about the back-end I'm using for another project.

https://medium.com/codex/poor-mans-cms-from...es-387e0eafc107

Live demo:
https://cutcodedown.com/caballero/

.zip and .tar.gz of the whole "completed" shebang.

https://cutcodedown.com/caballero/downloads

It's kind of in "release candidate" status for public use. The strengths are that it takes everything in <head> and everything at the bottom of the page like scripts out of your hands, wrapping them in a static object that makes usre they're in the right order. All you have to worry about is the common body template contents (/templates/default/body), a config file for a page (/pages/pageName.config.php) and the contents of the page (pages/pageName.content.php)

As PHP is a HTML scripting language, built from the start to output HTML, you don't HAVE to use PHP inside your page content, it is built to be optional.

It also has subdirectory support under /pages, so you can for example make:

https://cutcodedown.com/caballero/docs-definePrefixes

Is actually:

/pages/docs/definePrefixes.config.php
/pages/docs/definePrefixes.content.php

The former calling my Document object to set up things like the description META and any needed includes

CODE

<?php
/*
    pages/docs/definePrefixes.config.php
    Caballero Website Manager
    Jason M. Knight
    Last Modified: 10 Feb 2023 09:11 UTC
*/

Document::addMeta(
    'description',
    'Prefixes used at the start of all defines inside Caballero'
);
document::addStylesheet(TEMPLATE_DIR . 'docs.screen.css', 'screen', true);
define('PAGE_TITLE', 'Define Prefixes');



the latter being the page contents.

CODE

<section id="definePrefixes" class="docs">

    <h2>Define Prefixes</h2>
    <p>
        The following prefixes are used by the Caballero system to group its <code>define()</code>
    </p>

    <dl>

        <dt><var>CACHE_</var></dt>
        <dd>Caching files and locations</dd>
        
        <dt><var>FILE_</var></dt>
        <dd>relating to the local filesystem path</dd>
        
        <dt><var>HTML_</var></dt>
        <dd>Information used to build the markup, such as the character encoding,
        site title, etc.</dd>
        
        <dt><var>HTTP_</var></dt>
        <dd>involves the HTTP request and related paths.</dd>
        
        <dt><var>PAGE_</var></dt>
        <dd>specific to the current page</dd>
        
        <dt><var>SITE_</var></dt>
        <dd>information about the site and its configuration</dd>
        
        <dt><var>TEMPLATE_</var></dt>
        <dd>The currently loaded site template</dd>
        
    </dl>
    
    <ul class="actions">
        <li><a href="docs">Back To Index</a></li>
        <li><a href="docs-defines">Next Page: Defines</a></li>
    </ul>

</section>        


EVERYTHING else for that page plugged in by the back end. Things like the site title and so forth being set up in /config/site.config.php

PHP isn't hard, it's -- to me at least -- not all that different from JS apart from some minor syntax differences, the use of period instead of plus to indicate string addition, and of course variables starting with dollar signs.

But I'm an old school programmer, almost all mainstream languages are just C with Mr. Winkie tucked back, in a frilly dress with a purse and high heels.

I think it might be just what you're looking for if you want that level of "control" over the content markup, without the headaches of dialing in the rest of a page.

PHP makes really good glue, hooking together disparate bits of markup. Few languages in fact come close which is why you have painfully convoluted messes like React or Vue going out of their way to try and make something HTML-Like in node.js whilst still not feeling "natural". More so PHP has more robust -- IMHO -- string handling, particularly when it comes to "output buffering". As evidenced by the optional auto-minification, gzipping, and caching I implemented in about 20 minutes of work.

That help any?


User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Feb 11 2023, 07:37 AM
Post #23


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



QUOTE(pandy @ Feb 11 2023, 05:01 AM) *

QUOTE(Christian J @ Feb 11 2023, 02:40 AM) *

(You can also make PHP run in files with ".html" extensions, by using a .htaccess directive --your webhost's support should provide specific details. Unfortunately the exact value of this directive may need to be changed every time the server's PHP version is updated.)


How stupid. Great way to complicate things. Is there a good reason for this?

None that I can think of, couldn't found any documentation last time I searched. It didn't use to be like this years ago. Maybe it depends on the Apache configuration. unsure.gif

It gets even worse if a webhost randomly decides to install new PHP versions without notifying their customers. Last time it happened my neglected website was down for three months before I noticed.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Midwinter
post Feb 11 2023, 09:05 AM
Post #24


Newbie
*

Group: Members
Posts: 10
Joined: 28-January 23
Member No.: 28,774



Hi all.

Christian - thank you for the above - I'm going through that as I'm writing this.

Jason - I was following that article on Medium as you were writing it and downloaded Caballero as soon as I was able and then started going through the code. In short - yes, it does help.

I'm going to have questions for both of you later on today or tomorrow, so I'll be back with those as soon as I've researched enough so I don't have to ask too many things needlessly.

Jason, in the meantime though, your CMS - I'm assuming that it can handle styling changes etc... Will I be able to make it look something similar to the webpage rewrite that you've already done?

Also...sent you a message on your website, but not sure if you've seen it yet.

As an additional/final note - I'm a very visual/hands on learner - almost to the point of saying that reverse engineering is somewhat easier for me to handle than building things from the ground up.

This conversation has been the absolute best learning experience that I've ever had.

You've all been exceptionally courteous, kind, patient and more than helpful with me and you're a credit to this website.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Midwinter
post Feb 17 2023, 03:49 PM
Post #25


Newbie
*

Group: Members
Posts: 10
Joined: 28-January 23
Member No.: 28,774



Jason - in the htaccess file, line 31, do I need to uncomment lines 32 to 36 or just the one regarding https if I have forced ssl on the website?

Not sure if this part is relevant but I don't have www at the beginning of the URL.

Finally, once I've made my changes, if I repack the file and include a text file that lists all the changes that I've made, would you have time to take a quick look, just to make sure that I've done it correcly, please?

By the way...

What's the separator that you've used for the file names, please? My screen's too small for me to see - but it looks like a small square?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

2 Pages V < 1 2
Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 11:25 AM