getting fields of a section (getFields()) I feel like I'm doing this wrong (looping on section fields):

{% for fieldLayoutField in craft.entries.section('rentalsBulletin').getEntryTypes().first.getFieldLayout().getFields() %}
    {% set field = craft.fields.getFieldById(fieldLayoutField.fieldId) %}
    {% include 'rentals-bulletin/_components/form-field-types/' ~ field.type %}
{% endfor %}


Building a front-end "create" page. Goal is loop through fields and depending on type include a snippet to build the form. Basically, get section fields and build the form dynamically.

EDIT: if you didn't see the accepted answer comments, the way to do this when you don't have an entry to work with is:

{% for fieldLayoutField in craft.sections.getSectionByHandle('rentalsBulletin').getEntryTypes()[0].getFieldLayout().getFields() %}
You don't need to go through craft.fields to get the fields. They are already there.

{% set fields = craft.entries.section('rentalsBulletin').getEntryTypes().first.getFieldLayout().getFields() %}
{% for field in fields %}
    {% set type = field.getField().type %}
    {% include 'rentals-bulletin/_components/form-field-types/' ~ type %}
{% endfor %}


You will probably also want to pass some variables into your included templates to actually build the fields with the proper field names as well.

{% set properties = { 'name': field.getField().handle } %}
{% include 'rentals-bulletin/_components/form-field-types/' ~ type with properties %}


There are also a few plugins available on the plugins page for form building that you might want to check out.

Update Looks like craft.entries.section('rentalsBulletin').getEntryTypes() returns null when there are no entries defined. Instead you can go through a different route that doesn't seem to depend on entries.

{% set fields = craft.sections.getSectionByHandle('news').getEntryTypes()[0].getFieldLayout().getFields() %}