Search

Browsing all 840 documents · showing 451–500

Records in templates /books/theme-repo/rendering Navigation and menus /books/user-documentation/navigation-and-menus Scheduled jobs /books/hooks/scheduling Forms and submissions /books/user-documentation/forms-and-submissions Custom endpoints without writing framework code /books/apis/endpoints Documentation and books /books/user-documentation/documentation-and-books Reference /books/hooks/reference Publishing and workflow /books/user-documentation/publishing-and-workflow Client code and imports /books/apis/client General /books/user-documentation/general AI assistants and the MCP server /books/apis/model-context-protocol Around the main content /books/theme-repo/page-edges Common /books/user-documentation/common Customization /books/user-documentation/customization Transactions /books/user-documentation/transactions Send an email when a record is created A job on the record's create event, or a form's Completed event, with one Send mail action whose body is a template in your repository. Read a submission's answers through data, escape them, and reply-to the sender. /how-to/send-an-email-when-a-record-is-created Model a simple directory as a custom entity Sixty stores with an address, hours and a photo are a definition with a listing path, a record path, a handful of areas, tags for facets and a positioned or alphabetical listing. No PHP, two templates. /how-to/directory-as-custom-entity Remove a query-per-row from a template loop A lookup inside a loop runs once per row. Collect the keys first, fetch every record in one query, and read from a map inside the loop. /how-to/remove-a-query-per-row Post a record to an external API when it changes An UpdateRecord job with Pre-Event properties, a condition that passes only real changes, a payload built as a value, and an idempotent PUT to the other system with retries. /how-to/post-a-record-to-an-api-when-it-changes Create an input type for a design-token dropdown A select input type whose option keys are CSS classes and whose labels are what the author reads. Define it once, reuse it on every layout that offers the choice, and print the key straight into class="". /how-to/design-token-input-type Cut a bundle in half with dynamic imports Find the heavy library that most visits never use, load it only when it is needed, and measure what every page saved. /how-to/cut-a-bundle-with-dynamic-imports Organise a long editing form with area groups Groups split a form past about ten fields into named, collapsible sections, ordered as you set them; ungrouped areas follow after. Templates are unaffected: they read areas by name whatever group holds them. /how-to/area-groups Show content only on production Environment names are free text, so do not test for the word "production". Test that this is the site's primary environment and the request came to one of its own hostnames, once, in the base template. /how-to/production-only-content Run the go-live checklist Launch day in the order it has to happen, with one script that checks the things people forget after the DNS switch, and the template guard that keeps staging out of search engines. /how-to/run-the-go-live-checklist Make an area an attribute instead of content Tick Attribute on the layout area and it leaves the content form for the Attributes tab, button or cog, depending on where it lives. Templates read it exactly as before; only the author's form changes. /how-to/area-as-attribute Render a custom entity listing and detail page The listing renders the definition's template with the records under the plural identifier plus _pagination; the detail renders the layout's template with the record under the identifier and as record. Both are 404 without a template. /how-to/custom-entity-listing-and-detail Attach alt text and a crop as attributes of an image area An attached attribute is an attribute with a parent: it sits behind a cog next to the image field and moves with it. Add imageAlt (text) and imageCrop (select) with the image as parent, and read them by name. /how-to/image-alt-and-crop-attributes Register a page-specific JS bundle with a CSP nonce Build a separate entry, queue its URL from the template or component that needs it through _templateContext, and let the base template print every queued script once, with the nonce and the deploy hash. /how-to/page-specific-js-bundle Loop over a set of records without timing out Run the work in the background, in bounded chunks selected by what is still to do, in a parallel loop that contains its failures, on a schedule that repeats until nothing is left. /how-to/loop-over-records-without-timing-out Cache-bust an asset URL Append the deployed commit to every built asset URL with getLastVcsHash(); it changes on every deploy. Uploaded files use the change-time setting, and replaced images clear their own cache. /how-to/cache-bust-an-asset Set up an approval workflow before publishing A workflow is steps and transitions assigned to a content type or one record. Once assigned, every save goes into a branch; approval groups must all approve a gated transition; reaching the last step activates the revision. Publishing stays separate. /how-to/approval-workflow Migrate a WordPress site's content to pages and blogs Read the posts and pages from WordPress's REST API, write them into a Core dna blog and pages through Core dna's, keep their dates and categories, and produce the redirect map as you go. /how-to/migrate-wordpress-content Build your first standalone component A component layout is a layout with no controller whose template lives under components/. Create the template, register the layout, add it to a collection's supported layouts, and read your areas from component. /how-to/first-component Tell whether a site is Smarty or Twig in thirty seconds Open any file under templates/ and read the delimiters. Braces with a dollar sign are Smarty; double braces and percent tags are Twig. The file extension proves nothing; the setting is Globals.template.engine, set in the site's .settings.json. /how-to/which-engine Add a filterable tag facet to a listing Tags are flat, shared across types and already filterable on every listing route: append /tags/<slug> to the listing path. Build the facet from the tags in use, mark the active one from the route's tag variable, and combine with + or comma. /how-to/tag-facet-on-a-listing Add a component collection an author can fill A collection is a layout area whose input type has the collection category. Add it to the layout, name the component layouts it accepts, and loop its elements in the template, rendering each element's component. /how-to/component-collection Bulk-import redirects from an old site Turn a file of old and new URLs into published redirects in one run, test every one of them, and catch the old URLs that only differ by query string, which redirects alone cannot match. /how-to/bulk-import-redirects Set up a base template and extend it One base template holds the document, the head, the chrome and the script queue, and defines blocks. Every page-type template extends it and fills the blocks. Both engines do this the same way. /how-to/base-template-and-extend Restrict which components an author may add to a collection Supported layouts on the layout area decide what the add menu offers. Fill them in on every collection and component area; an empty list offers every component layout on the site, including the block itself. /how-to/restrict-collection-components Move from server-rendered to hybrid without a rewrite A site whose public pages are rendered for every visitor because of one personal element can be moved to cached pages with fragments one element at a time, keeping every template it has. /how-to/server-rendered-to-hybrid Pass a variable across an inheritance boundary An assignment at the top of a child template, outside any block, reaches the parent everywhere. An assignment inside a block does not: Smarty sees it only after the block, Twig never. For components, use the template context. /how-to/variable-across-inheritance Build a multi-step form with conditional steps A step shown only for business enquiries: the JS model, a group around the step's fields, and one hide rule acting on both the step and the group, because hiding a step alone leaves its required fields required on the server. /how-to/multi-step-form-with-conditional-steps Page through a large API result set without timing out A REST list with no limit returns everything in one response, which times out on a large site. Page by id instead: order by id, ask for ids above the last one seen, stop on a short page, and resume from the stored id next time. /how-to/page-through-a-large-result-set Convert component attributes into CSS classes Selects and multiselects whose keys are classes, and switches named after the class they turn on, become one class string through a shared helper, so no component carries the loop. Include it in Smarty, import it in Twig. /how-to/attributes-to-css-classes Show a field only when another field has a given value One rule that both shows the field and makes it required, with Required left unticked, plus the conditionals printed for the browser. Required with a show rule alone is the form nobody can submit. /how-to/show-a-field-when-another-has-a-value Call a PHP function from a Smarty template, and find out why one is blocked Call the function, do not pipe to it: trim($x) compiles, $x|trim does not. Ninety-eight PHP functions are callable, seven are allowed as modifiers, and Smarty's own modifiers always work. The error names the call. /how-to/call-a-php-function-in-smarty Create your own JSON endpoint with a synchronous job A synchronous web-event job is an endpoint built in the admin. Retrieve a record from the request, branch on whether it was found, and reply with encoded JSON: a 200 with the record or a 404 with an error, and nothing deployed. /how-to/json-endpoint-with-a-synchronous-hook Style a form without forking every input template CSS scoped to the form and aimed at the platform's own class names, a few classes the editors apply, and at most one or two inputs overridden with a partial that falls back to the platform's markup. /how-to/style-a-form-without-forking-inputs Seed JavaScript state from a template without a second request Data the template already rendered belongs in the page, not in a second request. Encode it into a JSON script tag, parse it once at start-up, and keep per-visitor data out of cached pages. /how-to/seed-javascript-state-from-a-template Take a payment inside a form A donation form: a Payment element on its own last step, set to Authorize & Capture, the platform's payment script in the layout, and a receipt sent from the form's Completed event, because the platform sends none. /how-to/take-a-payment-inside-a-form