Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

FIXED! - "Add" button pointing to "WebsiteURL/#" - NoBrainerWeb / Silverstripe-Content-Blocks


Go to End


7 Posts   1466 Views

Avatar
DowntownScience

Community Member, 13 Posts

6 March 2015 at 6:46am

Edited: 18/03/2015 9:42am

SS Noob here so please bare with me!

EDIT: See final post for fix.

I have all the module and all dependencies installed. All "private" have been changed to "public" in .php files for content-blocks and all dependencies. Permissions have been fixed. No errors upon /dev/build.

Block Admin is working. I can create a new block, navigate all tabs, use all buttons, and save. Thumbnails show.

My problem is when I'm in the "Block" tab for a page. The drop down list is working. However, when I click the "Add" button it takes me to my home page. The button displays "WebsiteURL/#" and that's it. When I look at the "Add Block" button from within the Block Admin it shows "WebsiteURL/admin/blocks/Block/EditForm/field/Block/item/new". I'm not sure what is missing, and I'm not sure where I should be looking for it!

Please help!

Avatar
wmk

Community Member, 87 Posts

6 March 2015 at 7:04am

Did you install the BetterButtons module? http://addons.silverstripe.org/add-ons/unclecheese/betterbuttons This is where the BetterButtonsAction class comes from.

Did you flush and a dev/build after installing all dependencies?

I strongly suggest to use composer for installation of silverstripe / modules...http://doc.silverstripe.org/en/getting_started/composer/ which will install all dependencies listed in the composer.json automatically...

Avatar
DowntownScience

Community Member, 13 Posts

6 March 2015 at 7:18am

I did install the BetterButtons module. I did notice this just now.....the error states that "Class BetterButtonsActions does not exist". Notice the "s" in "Actions". I did find a .php file in the code folder of "betterbuttons" that is called "BetterButtonAction.php".....no "s". Everything within the file references "BetterButtonAction" without the "s". I'm guessing there is something within the "content-blocks" code that has a typo? All other Better Button actions appear to extend the class named without the "s".

/dev/build and ?flush=1 have performed a number of times.

You know I do have composer, but I've noticed that while it does connect and pull down what I want, it doesn't put it in a place that updates anything. Composer thinks its updated, but my SS isn't updated. Nothing changes with my DB when I run /dev/build after installing with composer. I just updated my SS manually by copying the contents of "cms" and "framework" from "projectname\vendor\composer". Everything goes into that composer folder. Again I'm sure I've done something wrong or just failed to configure something to suit my environment. I originally installed SS using composer so I'm not sure what else was supposed to happen after that. Any ideas there?

What about the LogFileWriter.php error? Is that a permissions issue? Not sure why I get something written to the logfiles when I /index.php/dev/build, but not when I just /dev/build. (fixed the index.php yesterday).

If there are any files or screenshots that wish me to post, please let me know.

Thanks again for your reply and assistance.

Avatar
DowntownScience

Community Member, 13 Posts

6 March 2015 at 7:32am

OK...this is crazy. I went back into CMS, clicked on the Block Admin icon, click add Block and it took me to the next screen! Not sure what changed here, but I should be able to work on it now! It used to just take me to a blank white screen with the CMS window borders.

There is still an issue when trying to add a block to a page from the Block tab. I can choose the block type from the drop down menu, but when I click "add" it takes me to mywebsiteURL\#. Not sure if this is failing because there aren't yet any blocks created. I'll fiddle with this some more.

Would like to get the composer problem worked out though so if you can lend a hand I'd greatly appreciate it.

Avatar
wmk

Community Member, 87 Posts

6 March 2015 at 7:52am

I stumbled over an issue with suhosin today. So, what php version / distri do you use and do you have any errors in your webserver error.log or /var/log/syslog? Suhosin writes to syslog, not webserver log :(

I had to increase some vars to get gridfield pagination in Modeladmin working. Maybe it's something similar?

See https://github.com/silverstripe/silverstripe-framework/issues/3855 for more info on this.

Avatar
DowntownScience

Community Member, 13 Posts

18 March 2015 at 10:18am

Edited: 18/03/2015 10:22am

Since I really don't know a whole lot about this stuff I thought I would take it back to basics! I cloned the Ubuntu workstation I was using for my live site so that everything was the same. I used Composer to install a project named TEST using the most current stable version of Silverstripe, then fixed permissions, confirmed mod_rewrite, etc. I had tried to use Composer to install modules and update dependencies in the past, but it didn't seem to work. When you install a new project using Composer you specify the path to where you want it installed. Whenever I was running Composer I was running it from my home directory and always wondering "How does Composer know which project I want the modules installed too!?". Well, figured that one out! For those that don't know, you run it from your project root. (ie. Open terminal and change your working path to /var/www/ProjectName, then run composer). The modules appear in your project root and when your run /dev/build it will actually do something! The other thing that I noticed is that after installing content-blocks to my TEST project using composer I didn't have to mess with changing any "private" to "public". I had originally been trying to install the content-blocks module by copying the folders to "mysite", then running /dev/build. So after installing content-blocks using composer to a fresh install of silverstripe I tried to do what I couldn't before and was amazed to find that everything was working as it should!

So I went to the live site, pulled all the modules out, ran /dev/build, and then tried to install content-blocks using composer. Composer died. Composer.json file hadn't been updated in quite some time obviously! Made a correction to the required version and tried installing content-blocks with Composer again. My blog module and a number of other modules got updated as well and things stopped working for a bit. After making some "private" to "public" corrections in my Blog module I got everything functional again.

When I went to test the "Add" button from the "Block" tab this time I got an error.

[12-Mar-2015 16:18:17] Error at framework/model/MySQLDatabase.php line 598: Couldn't run query:
SELECT DISTINCT "Block"."ID", "SortOrder"
FROM "Block"
INNER JOIN "Page_Blocks" ON "Page_Blocks"."BlockID" = "Block"."ID"
WHERE ("Page_Blocks"."PageID" = '159')
ORDER BY "SortOrder" ASC
LIMIT 2147483647

Column 'SortOrder' in field list is ambiguous (http://norcalscans.org/admin/pages/edit/EditForm/field/Blocks/add-multi-class/Block)
[12-Mar-2015 16:19:34] Error at framework/model/MySQLDatabase.php line 598: Couldn't run query:
SELECT DISTINCT "Block"."ID", "SortOrder"
FROM "Block"
INNER JOIN "Page_Blocks" ON "Page_Blocks"."BlockID" = "Block"."ID"
WHERE ("Page_Blocks"."PageID" = '159')
ORDER BY "SortOrder" ASC
LIMIT 2147483647

With my very limited knowledge of PHP and Silverstripe I was thinking another "private" to "public" issue. Tried investigating further but was running into a wall again and figured I could just move my database information over to the working TEST project and call it good. Exported my LIVE DB and attempted to import into my TEST project. Error. Then I realized you need a blank DB to import the data into and got this part fixed. With my LIVE DB imported into the TEST project I thought I was good to go after updating styles, header, footer, etc. but when I tried to "Add" a block from the "Block" tab I got the same error. Problem not solved! :-(

So I'm in PHPMyAdmin looking around. Looking at my live DB, looking at my TEST DB. Checking the number of rows in use, etc. Looking for similarities and differences in the one that works and the one that doesn't. While I have tested both neither have any saved blocks. I noticed that the Table named "Block_Images" had a few extra rows in use than the one in my TEST project. I took a look at the rows in use and I notice that there is an ID that is in use more than once. It didn't really seem to fit with what I was seeing in the other that was working.

With that in mind I decided I would remove the content-block module, remove the 3 tables named "block_*" and then reinstall with Composer. After running /dev/build the tables were re-created and BOOM! All working now!

NoBrainerWeb Content-Blocks wasn't the only content-block module I tried to get going. I tried 3, failing miserably each time. My guess is that one of the other content-block modules wrote something to the DB corrupting it at some point.

Now I have other questions/issues about linking the blocks, setting a border that I will address in another post!

Avatar
wmk

Community Member, 87 Posts

18 March 2015 at 8:46pm

Hi DowntownScience,

glad you got it working and thanks for sharing your experience or the way you got it working. This may help others with similar problems.

The mysql "column Foo is ambiguous" error is pretty common when you join tables and both have the column "Foo". So the database doesn't know which Foo it should take for an operation.

Have a good day and enjoy coding!

wmk