Auto-deduced Element IDs
Often there would be elements you want to insert into the tree which do not really contribute to the functionality. Such elements would not have any definition in the Elements file (the 2nd file of the build) Nor would they have any definition for HTMX and AlpineJS (the 3rd and 4th file of the build) For example, you just want to insert a <br> or an <hr> element. In such a case, here is an example of a fragment you write in the tree file (the 1st file of the build):
In the above fragment, the <body> element has 3 direct children, whose IDs are "txa", "hr_1" and "txb". Let us assume that "txa" and "txb" are defined further in one of the other 3 files. i.e. either in the 2nd file where elements with their attributes are defined or in the HTMX file or in the AlpineJS.
And let's assume that "hr_1" was never further explained anywhere else — after all it is just a simple horizontal rule, and it really does not contribute to the functionality as such. Nor was it used to start another fragment in the tree. In the above example, you have created a special element ID called "hr_1" where you took care to construct the id as the tagname (in this case "hr") followed by an underscore and some unique random val. So in such a case Cull Front will "auto-deduce" an ID as "hr_1" and attempt use it.
The usage of such autodeduced IDs can be done in two ways. This id would get inserted into the HTML if the autoid setting was given as autoid(1) in the cullfront.settings.txt file. If you wrote autoid(0) in the cullfront.settings.txt then the ID does not get written for such an element. So you would see something like this in the output if you used autoid(1) in the cullfront.settings.txt file:
Or if autoid(0) was given in the cullfront.settings.txt then you would see the output something like this:
As you can see in the 2nd case the <hr> does not get an element ID in the final HTML.
Last updated