new block from content block img problem
Permalink
Hi,
i am trying to create a new block based on the 'content block'. I copied the content block to the root/blocks renamed the folder the class and the dbtable.
the new block installs and works for entering text but when i insert an image or a link things go wrong.
<img src="{CCM:FID_169}" alt="sd35n_150.jpg" width="150" height="103">
the src is'nt correct
same problem for the links to other pages
i tracked the code to the function
but since i didn't change anything here i am lost
thanks for the help
Marco
i am trying to create a new block based on the 'content block'. I copied the content block to the root/blocks renamed the folder the class and the dbtable.
the new block installs and works for entering text but when i insert an image or a link things go wrong.
<img src="{CCM:FID_169}" alt="sd35n_150.jpg" width="150" height="103">
the src is'nt correct
same problem for the links to other pages
i tracked the code to the function
function translateTo($text) {
but since i didn't change anything here i am lost
thanks for the help
Marco
Thanks Jordan
One of the screen shots looks like the thing i want to build, i'll let you know how it went
Gr. Marco
One of the screen shots looks like the thing i want to build, i'll let you know how it went
Gr. Marco
Hi Jordan
i installed the designer content package but when i try to create a block i always get the error :
Cannot proceed! Please correct the following errors:
* Block Handle is already in use (either by another package, block type, or database table).
i tried different block handles lowercase and only underscores but always the same error.
any ideas?
by the way, it is indeed part of the functionality i was looking for
thanks
Marco
ps i just downloaded the package and put it in the package folder in the root of one of my localhost test sites that is not connected to the community, this is not a problem?
i installed the designer content package but when i try to create a block i always get the error :
Cannot proceed! Please correct the following errors:
* Block Handle is already in use (either by another package, block type, or database table).
i tried different block handles lowercase and only underscores but always the same error.
any ideas?
by the way, it is indeed part of the functionality i was looking for
thanks
Marco
ps i just downloaded the package and put it in the package folder in the root of one of my localhost test sites that is not connected to the community, this is not a problem?
Hi Marco,
That is very strange that you'd get that error all the time. Try something completely random like "my_strange_handle_4928" -- if that doesn't work then something is definitely going on. Might be with file permissions of the package directory on your server (not sure why but that issue has been coming up a lot recently).
It doesn't matter that you just downloaded the package -- I never connect my sites to the community and they always work just fine.
Let me know if you still can't get it working and I'll see what else I can think of.
That is very strange that you'd get that error all the time. Try something completely random like "my_strange_handle_4928" -- if that doesn't work then something is definitely going on. Might be with file permissions of the package directory on your server (not sure why but that issue has been coming up a lot recently).
It doesn't matter that you just downloaded the package -- I never connect my sites to the community and they always work just fine.
Let me know if you still can't get it working and I'll see what else I can think of.
Hello Jordan,
i had already tried different handles,now i also set the permissions for the package directory to read/write for everyone, but still the problem remains.
my setup :
MacOS 10.6.7
Apache 2.2.17 (Unix)
PHP 5.3.4
Mysql Server version: 5.1.53
i had already tried different handles,now i also set the permissions for the package directory to read/write for everyone, but still the problem remains.
my setup :
MacOS 10.6.7
Apache 2.2.17 (Unix)
PHP 5.3.4
Mysql Server version: 5.1.53
Okay, I think I might know what's going on. How exactly did you install this? Did you pull any files or folders out of the downloaded package?
Make sure this file exists on your server:
If that file does exist, make sure it has read permissions by the web server.
If the file isn't there, then you did something wrong to install this (didn't copy all of the files or something like that).
-Jordan
Make sure this file exists on your server:
YOURSITE/packages/designer_content/tools/validate_handle.php
If that file does exist, make sure it has read permissions by the web server.
If the file isn't there, then you did something wrong to install this (didn't copy all of the files or something like that).
-Jordan
Hi Jordan
that file exists and is readable
i tried the following
in file : js/designer_content_dashboard_ui.js
i changed
into
now my error is gone and the created block seems to work?
strange?
gr Marco
that file exists and is readable
i tried the following
in file : js/designer_content_dashboard_ui.js
i changed
} else if (!validate_handle(handle)) { errors.push(ERROR_MESSAGES['handle_exists']); }
into
} else if (validate_handle(handle)) { errors.push(ERROR_MESSAGES['handle_exists']); }
now my error is gone and the created block seems to work?
strange?
gr Marco
Err... well, all you've done there is turn off the error reporting, so if you did create a block that had the same handle as one that already exists, your existing block would get overwritten (and possibly whatever content you had in those blocks on the site would disappear). So I wouldn't recommend that...
but there's definitely something weird going on with the fact that that tools file isn't getting loaded properly. Do you have Firebug installed? If so, click on the "Net" tab and then click the "XHR" subtab, and see what URL is getting called when you try to save the block. Then paste that url into your browser address bar -- is there any kind of error outputted to the screen?
but there's definitely something weird going on with the fact that that tools file isn't getting loaded properly. Do you have Firebug installed? If so, click on the "Net" tab and then click the "XHR" subtab, and see what URL is getting called when you try to save the block. Then paste that url into your browser address bar -- is there any kind of error outputted to the screen?
Hello Jordan
i did what you suggested and the page returned '1' (no errors) what results in the error handle already exists
i tracked it down to this function
these first 3 checks i understand, when i use phpMyAdmin for the first 2 it returns a count of 0
when i do a search for a file or directory with the name of my handle i don't find any so that is also 0
this part of code i have trouble understanding, i don't find a table named like the handle but i don't understand what this last part actually does (exept for the return ;) .
gr Marco
i did what you suggested and the page returned '1' (no errors) what results in the error handle already exists
i tracked it down to this function
public function validate_unique_handle($handle) { $db = Loader::db(); $pkg_exists = $db->GetOne("SELECT COUNT(*) FROM Packages WHERE pkgHandle = ?", array($handle)); $block_exists = $db->GetOne("SELECT COUNT(*) from BlockTypes where btHandle = ?", array($handle)); $dir_exists = is_dir(DIR_FILES_BLOCK_TYPES_CORE . '/' . $handle) || is_dir(DIR_FILES_BLOCK_TYPES . '/' . $handle);
these first 3 checks i understand, when i use phpMyAdmin for the first 2 it returns a count of 0
when i do a search for a file or directory with the name of my handle i don't find any so that is also 0
Loader::library('block_generator', 'designer_content'); $tables = $db->MetaTables('TABLES'); $table_name = DesignerContentBlockGenerator::tablename($handle); $table_exists = in_array($table_name, $tables); return (!$pkg_exists && !$block_exists && !$dir_exists && !$table_exists); }
this part of code i have trouble understanding, i don't find a table named like the handle but i don't understand what this last part actually does (exept for the return ;) .
gr Marco
Sorry this is causing you so much trouble. There must be something about your server setup or maybe some other change that was made to your C5 installation at some point? I'm glad you keep trying to figure this out, though, and I'll keep helping as much as I can.
The code you are asking about is taking the block handle (for example, "my_custom_block"), and converting it to the format that C5 database table names are supposed to be in (for example, "btMyCustomBlock"). Then it checks to see if that table name exists in the database already.
The first line (Loader::library...) pulls in some helper code that's located in packages/designer_content/libraries/block_generator.php.
The second line ($tables = ...) retrieves the list of ALL tables in the database from MySQL and places them into an array.
The third line ($table_name = ...) is calling a helper function in that library code file that was pulled in on the first line -- this is where it converts the handle to the table name format.
The fourth line ($table_exists...) searches through the array of table names from the second line to see if the new table name from the third line is in it already.
Make sense?
The code you are asking about is taking the block handle (for example, "my_custom_block"), and converting it to the format that C5 database table names are supposed to be in (for example, "btMyCustomBlock"). Then it checks to see if that table name exists in the database already.
The first line (Loader::library...) pulls in some helper code that's located in packages/designer_content/libraries/block_generator.php.
The second line ($tables = ...) retrieves the list of ALL tables in the database from MySQL and places them into an array.
The third line ($table_name = ...) is calling a helper function in that library code file that was pulled in on the first line -- this is where it converts the handle to the table name format.
The fourth line ($table_exists...) searches through the array of table names from the second line to see if the new table name from the third line is in it already.
Make sense?
Jordan,
your right, my problem is related to this specific test site, when i install your package in an other site i don't get this error.
i must have done something wrong in my site.
When i find out what went wrong i will let you know
the upside is : i learned a lot and thats never a bad thing
thanks for your help
gr Marco
your right, my problem is related to this specific test site, when i install your package in an other site i don't get this error.
i must have done something wrong in my site.
When i find out what went wrong i will let you know
the upside is : i learned a lot and thats never a bad thing
thanks for your help
gr Marco
Could it have something to do with statistics? or maybe the core scrapbook (meaning something, anything in the scrapbook?). The last one was just a real shot in the dark though.
Hello Nornik
thanks for your input
i emptied all scrapbooks - no change
i turned off track page view statistics - no change
i even removed my own blocks i've created (in the dashboard & filesystem) - no change
i have probably done something wrong in the past and when i ever find out what it is i will post back to this forum.
gr Marco
thanks for your input
i emptied all scrapbooks - no change
i turned off track page view statistics - no change
i even removed my own blocks i've created (in the dashboard & filesystem) - no change
i have probably done something wrong in the past and when i ever find out what it is i will post back to this forum.
gr Marco
I recently updated the addon so it will overwrite an existing database table for you when needed. You might want to try downloading that and trying it out and seeing if that works any better.
Sorry Jordan,
i tried the 2.0 version but still the same error, also i didn't get the option to overwrite a database table?
gr Marco
i tried the 2.0 version but still the same error, also i didn't get the option to overwrite a database table?
gr Marco
Okay, well there's some other issue going on (sorry, I forgot about that other test you did with another site). You should just make the blocks you want on that other site where Designer Content works, then copy over the created block onto this site (it will be a folder inside your site's top-level "blocks" directory) and install it via the "Add Functionality" dashboard page.
Yes Jordan
Until i figure out what i did to mess up That site That is à solution i can work with
Thanks for all your input
Gr. Marco
Until i figure out what i did to mess up That site That is à solution i can work with
Thanks for all your input
Gr. Marco
Erm, I'm getting this same error. I've made absolutely sure the block handle does NOT exist.
I've been developing on my server for weeks and suddenly this error cropped up. I've tried retracing my steps and all I can see is I added an item to the scrapbook. Deleting it, however, doesn't solve the issue.
So I tried this on a local install of the same site and same issue. I did a mysqldump to local from the development server this morning - in which case this is a db issue, not an actual file structure problem.
Anyone found a solution? Thanks!
I've been developing on my server for weeks and suddenly this error cropped up. I've tried retracing my steps and all I can see is I added an item to the scrapbook. Deleting it, however, doesn't solve the issue.
So I tried this on a local install of the same site and same issue. I did a mysqldump to local from the development server this morning - in which case this is a db issue, not an actual file structure problem.
Anyone found a solution? Thanks!
Glad I found this thread. I was just about to make new thread on Designer content support forum about this issue. I'm running C5 on WAMP and 5.4.2.2 works as it should. However, I'm getting the same block handle error as described above. I've double checked everything that no such files/directories/db records/anything exists but I still get the error. Even the handle_validation returns 1 (as it should?) but the creation won't proceed.
I also tried using the most recent version of the package on github but it didn't solve the problem either.
I'm hoping to see this fixed soon. Thanks!
Edit: Just to clarify, the C5 installation was quite clean (only other packages were addthis, travisn_spacer and page_redirect_to_newest_child) and the error "came straight out of box" when I was trying to create my first custom block with designer content.
I also tried using the most recent version of the package on github but it didn't solve the problem either.
I'm hoping to see this fixed soon. Thanks!
Edit: Just to clarify, the C5 installation was quite clean (only other packages were addthis, travisn_spacer and page_redirect_to_newest_child) and the error "came straight out of box" when I was trying to create my first custom block with designer content.
Found it!
For some reason, there seems to be an extra line change on the output of the validate handle ajax call. When it should be just "1", it becomes: " 1" (where the space means is line-change)
This can be easily fixed by modifying the javascript function validate_handle() in designer_content_dashboard_ui.js. Instead of the following:
It should be:
Seems to work at least on my development environment :)
For some reason, there seems to be an extra line change on the output of the validate handle ajax call. When it should be just "1", it becomes: " 1" (where the space means is line-change)
This can be easily fixed by modifying the javascript function validate_handle() in designer_content_dashboard_ui.js. Instead of the following:
if (response == '2') {
It should be:
if (parseInt(response) == 2) {
Seems to work at least on my development environment :)
Ale you rock dude; solved for me too. Thx so much for A.) Chasing this and B.) Posting the response. You should be the proud recipient of a best answer for that!
Wow, you are the man!
Thanks for figuring this out, it's really helpful (I've never had this issue on any of my machines so I would never have been able to discover it myself).
I've updated the addon in the marketplace and on github.
Thanks for figuring this out, it's really helpful (I've never had this issue on any of my machines so I would never have been able to discover it myself).
I've updated the addon in the marketplace and on github.
Thanks, I'm glad to able to help other people while solving the problems I encounter :)
jordanlev: Good to hear that you already updated the add-on in both marketplace and github. That's what I'd call first class support, quick and efficient!
jordanlev: Good to hear that you already updated the add-on in both marketplace and github. That's what I'd call first class support, quick and efficient!
http://www.concrete5.org/marketplace/addons/designer-content...
If you just want to "get it done" this will do so very quickly and easily, but if you'd rather learn how to do it yourself this will also be helpful because it will show you the necessary code to make it work.
-Jordan