mike_henden

Thanks @dorsetdigital, hopefully hosting will respond to my request!

mike_henden

I'm trying to check with hosting company. Unfortunately it's client's hosting account, not mine so I'm just hoping that they will remember that I'm legit! Because I'm 'abroad' for the next few days!

mike_henden

Spark still offers an http://xtra.co.nz email address -- maybe not to new clients but if does support long-term clients who already use this. Nothing worse than a telco who suddenly withdraws email service and tells people to bugger off the GMail... ask any Vodafone customer!

mike_henden

I've asked her -- unfortunately we have a 5-hour time difference until next week which doesn't help! She is no doubt in bed at the moment!

mike_henden

I was hoping it was down to spam filters... as I said I'm not getting a copy either and I can't see it in any spam filtering? Mail is hosted on a related domain, and also at a large telco-owned ISP (http://xtra.co.nz). Have changed sender address to a generic one from the same domain, haven't touched SPF records but as mentioned everything has been working for a couple of years. And now it doesn't... 🤔

mike_henden

Hi @dorsetdigital, yes, it goes to the client's email address and a copy to me. I've tried test submissions but I'm not getting the copy at my end? Thought it happened suddenly down to an ISP problem but now I'm not so sure...

mike_henden

Hi people, I'm running a SS4 site with Silverstripe Enquiry Form handling form submissions. For some reason it seems to have stopped sending submissions through. Can anybody shed any light?

mike_henden

… so just to clarify @nightjarnz — this is a server setting rather than a Silvertripe setting?

mike_henden

Hi people, today’s question: where can I set size limit for uploaded assets (namely PDF documents)? Client wants to upload PDFs larger than 2MB but can’t…

CptPillow

You can add the following code in your .htaccess to increase the size allowed on uploads. php_value upload_max_filesize 20M php_value post_max_size 50M

mike_henden

Hi people, got a Database 101 question here; if I add the following to my page:

  1. private static $db = [
  2. 'Subtitle' => 'HTMLText',
  3. 'SingleColumn' => 'HTMLText'
  4. ];

I should see two new database fields generated for $Subtitle and $SingleColumn data, right? This should appear when I dev/build? Except this doesn’t appear to be happening? Further to my questions yesterday, it would appear that the corresponding fields in the CMS don’t have a table in the db to write to… Did I miss anything?

web

private static $table_name = ‘LandingPage’;

nightjarnz

Then yes, you should see both fields added to the database, unless Page already has one of those fields defined.

nightjarnz

you can try to make double sure by running /dev/build?flush=all

nightjarnz

(to ensure the flush is happening first, if the fields aren't showing).

nightjarnz

table name shouldn't matter @web - just makes things easier for those that go DB spelunking.

nightjarnz

or writing (generating) queries that aren't stupidly long.

web

New users might not know that it uses the namespace otherwise. So they are looking for the wrong name etc

nightjarnz

also resolves issues with 'odd' chars in table names (\)

nightjarnz

Yes, it also helps aid migrations, preserving data in unnamespaced tables. But aside from this it is mostly to do with human benefits, setting table_name isn't required for things to function :)

mike_henden

In reply to @nightjarnz and @web:

  1. private static $table_name = 'TwoColumnPage';

Page does not have these fields…

Will try dev/build?flush=all (normally do this in two stage)…

Thanks guys!

mike_henden

This has got beyond me! I’ve pulled unused page types out of the dev site, rebuilt database, reintroduced TwoColumnPage.php, rebuilt database (small changes), tested — data entered in new filed wasn’t uploaded/saved. Dropped entire database, restored from backup, rebuilt, think I saw fields appear, tested and — data entered in new filed wasn’t uploaded/saved. Been stuffing about with this for a few days now — is there any way I can introduce this site to the concept of democracy?

Can anybody tell me where to check if the fields actually exist? phpMyAdmin? Perhaps?

Sorry for the rant but it’s getting bloody frustrating!!! 😫

web

When you do the dev/build/, scroll down to under Creating database records do you see \TwoColumnPage in the list?

mike_henden

Hi @web, yes I did. And now, looking at phpMyAdmin, I see that there is a table for that page type –– mediumtext, utf8_general_ci, no attributes, ‘null’ = yes, default = none, no ‘comments’ and no ‘extra’ ??

Mean anything to you?

web

Now if you go to the CMS, have you created a page using the TwoColumnPage template? I know it sounds like a stupid question, but just checking.

On that page you should have your new fields in the Main tab.

mike_henden

Done and just re-done. Page works, saved successfully — only thing is when I save page text entered in Single Column field vanishes… completely… 😪

web

Are you able to post your TwoColumnPage code here?

web

I see the problem. In your TextareaField you have a space for the field name parameter ‘Single Column’. You want to add it like TextareaField(‘SingleColumn’‘.‘Single Column’). The first parameter is your DB field name and the second is the title you want to display.

Basically, there is no field in the DB called ‘Single Column’, it is called ‘SingleColumn’ without the space between the words.

web

$fields->addFieldToTab(“Root.SingleColumn”, new TextareaField(‘SingleColumn’,‘Single Column’));

mike_henden

Hmmm — a very worrying underline right aliong that line. And a ‘white screen of death’ in browser?!

mike_henden

Now — how could I add *TinyMCE` editor to this field??? Can this be done?

web

Yes, that is easy, however you would have to update your DB record to HTMLText and then change the TextareaField into HTMLEditorField.

mike_henden

Cool!! Got it! One final question: is there a way to add this to the main content screen rather than the root.tab??

nightjarnz

well actually, for a sneaky trick, the reason this may have tripped you up @mike_henden is that SilverStripe scaffolder will automatically insert spaces into field names (aka unique ID, first param) to generate the title (param 2) where CamelCase is involved. thisfieldname will be used as the title thisfieldname where as ThisFieldName will become This Field Name.

Important to note is that this does NOT happen in reverse ;)

nightjarnz

i.e. spaces are not removed to search for a matching field name on a DataObject when Form::saveInto is used.

nightjarnz

and for the last question there, $fields->addFieldToTab($tabName, $field);

nightjarnz

where tab name in this case would probably be Root.Main, iirc.

mike_henden

@nightjarnz -- sneaky indeed! Does the use of single quotes prevent this? Thanks everybody for your help -- SS4 is a whole new ball game!!

nightjarnz

Nope. Strings are strings, it's only variable interpolation that double quotes allow (i.e. at definition time, the do nothing to the 'type' of resulting string).

nightjarnz

so, long story short: HTMLEditorField::create('SingleColumn') would work just fine, and still render the title as Single Column

theruss

FYI, that "sneakiness" is done by FormField::name_to_label() which I find super useful, and use it all the time

nightjarnz

Same, it was just interesting to me reading this thread how much I take it for granted though.


Show less replies