Hello,
Some days ago I had asked on this list how to add content in Drupal from the mysql command line. I only got one suggestion to try the import_HTML module (http://drupal.org/node/46008) but it really seems an overkill, and not the best approach to what I have to do.
I had also asked how to do the same thing in two different ways in the forums: http://drupal.org/node/62954 http://drupal.org/node/68605
without result so far: no feedback from others who posted, who I contacted directly, no usable documentation I could recognize, nothing...
Honestly, I can't believe this has never been done before: What I need to do is something that (OUTSIDE Drupal) reads a .txt file like this:
ARTICLE_CATEGORIES="travel/england/london, food/foreign/restaurants" TEXT="path/to/some/local/html/file/" CREATED_ON_DATE="YYYY/MM/DD" AUTHOR="John Doe"
etc etc.... (other variables like, for example, "create_a_forum_for_this_node")
and upload the node inside the Drupal database, just if I had inserted everything by hand in the proper drupal form.
I don't want to do it via drupal because I need this to happen regularly and automatically (say, a cron job on my home PC which publishes via ssh whatever file in $DRUPAL_CONTENT folder changed in the last hour): it's not a one-time job.
I've also tried to look for scripts doing this via the blogger API (or usable documentation on how to write them so they _are_ drupal compatible): nothing.
What am I missing? Is it really possible that everybody is happy pasting and changing stuff manually in a tiny textarea, EVERY darned time some node must be added or updated??
Thanks,
O.
The reason this is not just a matter of inserting content into a table is because Drupal uses more than one table to manage the site.
There are a number of import modules available. It sounds like you know what you're doing, so maybe you can use one of those modules for a code base to create a custom mod for your needs. Having tasks handled by cron is something many modules do.
I'm assuming the developers list pointed you to the api documentation.
If you want a desktop solution, you might start with something like Performancing or even ecto.
Hope this helps.
Laura
On Jul 2, 2006, at 9:45 AM, dondi_2006 wrote:
Hello,
Some days ago I had asked on this list how to add content in Drupal from the mysql command line. I only got one suggestion to try the import_HTML module (http:// drupal.org/node/46008) but it really seems an overkill, and not the best approach to what I have to do.
I had also asked how to do the same thing in two different ways in the forums: http://drupal.org/node/62954 http://drupal.org/node/68605
without result so far: no feedback from others who posted, who I contacted directly, no usable documentation I could recognize, nothing...
Honestly, I can't believe this has never been done before: What I need to do is something that (OUTSIDE Drupal) reads a .txt file like this:
ARTICLE_CATEGORIES="travel/england/london, food/foreign/restaurants" TEXT="path/to/some/local/html/file/" CREATED_ON_DATE="YYYY/MM/DD" AUTHOR="John Doe"
etc etc.... (other variables like, for example, "create_a_forum_for_this_node")
and upload the node inside the Drupal database, just if I had inserted everything by hand in the proper drupal form.
I don't want to do it via drupal because I need this to happen regularly and automatically (say, a cron job on my home PC which publishes via ssh whatever file in $DRUPAL_CONTENT folder changed in the last hour): it's not a one-time job.
I've also tried to look for scripts doing this via the blogger API (or usable documentation on how to write them so they _are_ drupal compatible): nothing.
What am I missing? Is it really possible that everybody is happy pasting and changing stuff manually in a tiny textarea, EVERY darned time some node must be added or updated??
Thanks,
O.
-- [ Drupal support list | http://lists.drupal.org/ ]
Hi
I have tried using php script as described on the drupal site to make new blocks I make to only show up after the user has logged in.
I have tried to use path to make blocks not appear or appear only on the front side before people have logged in.
Non of it works.
I have my alias url enabled, I have php enabled, nothing works.
I also have a problem with the front page that shows up with the URL followed by this: /?q= The path configuration will not accept this as a path, yet this is the only "path" showing up at the front before you have logged in and at the first page (home page) after you have logged in.
Tips anybody?
Best Gina
You appear to be asking several different questions, but I'm also not entirely sure I understand your English. I will attempt to answer as best as I can.
On Sunday 02 July 2006 11:57, Gina Rydland wrote:
Hi
I have tried using php script as described on the drupal site to make new blocks I make to only show up after the user has logged in.
On your block configuration page in the "Page specific visibility settings" area, select the PHP option (the third one) and try something like the following:
<?php global $user; if ($user->uid) { return TRUE; } else { return FALSE; } ?>
That will show the block with the content you specified in the "Block body" area on every page only after the user has logged in. If you also want to exclude the admin account, change "if ($user->uid) {" to "if ($user->uid > 1) {".
Also, if you want brevity, the following will work: <?php global $user; return $user->uid; ?>
I have tried to use path to make blocks not appear or appear only on the front side before people have logged in.
Using the above example, you would place the code in the "Block body" instead, but change it like so:
<?php global $user; if (!$user->uid) { --PUT YOUR BLOCK CONTENT HERE AS PHP CODE-- } ?>
Make sure your "Input format" is set to "PHP Code". Next, in the "Page specific visibility settings" area, select the "Show on only the listed pages." option and put the following in the textarea: <front>
That will show the block ONLY on the front page, and only if the user is NOT logged in.
All of this is outlined in the "Controlling block visibility with PHP" handbook page: http://drupal.org/node/64135
Non of it works.
I have my alias url enabled, I have php enabled, nothing works.
I also have a problem with the front page that shows up with the URL followed by this: /?q= The path configuration will not accept this as a path, yet this is the only "path" showing up at the front before you have logged in and at the first page (home page) after you have logged in.
You should only use the part after the ?q= when ever referencing a path. i.e.: if the path is: http://www.domain.com/?q=admin/settings use admin/settings
For situations where you are referencing the front page, then either http://www.domain.com/ or / will do.
Also, if your Web server can handle it, you might want to enable Clean URLs (which can be found on the above admin/settings path). This page explains Clean URLs: http://drupal.org/node/15365
Tips anybody?
Best Gina
Hopefully, that helps you out.
Hi
You should only use the part after the ?q= when ever referencing a path. i.e.: if the path is: http://www.domain.com/?q=admin/settings use admin/settings
Answer: The problem is that there is nothing after ?q= on my front page, it is just the URL followed by /?q=
Gina
----- Original Message ----- From: "Jason Flatt" drupal@oadae.net To: support@drupal.org Sent: Monday, July 03, 2006 7:19 PM Subject: Re: [support] Path does not work
You appear to be asking several different questions, but I'm also not entirely sure I understand your English. I will attempt to answer as best as I can.
On Sunday 02 July 2006 11:57, Gina Rydland wrote:
Hi
I have tried using php script as described on the drupal site to make new blocks I make to only show up after the user has logged in.
On your block configuration page in the "Page specific visibility settings" area, select the PHP option (the third one) and try something like the following:
<?php global $user; if ($user->uid) { return TRUE; } else { return FALSE; } ?>
That will show the block with the content you specified in the "Block body" area on every page only after the user has logged in. If you also want to exclude the admin account, change "if ($user->uid) {" to "if ($user->uid > 1) {".
Also, if you want brevity, the following will work:
<?php global $user; return $user->uid; ?>
I have tried to use path to make blocks not appear or appear only on the front side before people have logged in.
Using the above example, you would place the code in the "Block body" instead, but change it like so:
<?php global $user; if (!$user->uid) { --PUT YOUR BLOCK CONTENT HERE AS PHP CODE-- } ?>
Make sure your "Input format" is set to "PHP Code". Next, in the "Page specific visibility settings" area, select the "Show on only the listed pages." option and put the following in the textarea:
<front>
That will show the block ONLY on the front page, and only if the user is NOT logged in.
All of this is outlined in the "Controlling block visibility with PHP" handbook page: http://drupal.org/node/64135
Non of it works.
I have my alias url enabled, I have php enabled, nothing works.
I also have a problem with the front page that shows up with the URL followed by this: /?q= The path configuration will not accept this as a path, yet this is the only "path" showing up at the front before you have logged in and at the first page (home page) after you have logged in.
You should only use the part after the ?q= when ever referencing a path. i.e.: if the path is: http://www.domain.com/?q=admin/settings use admin/settings
For situations where you are referencing the front page, then either http://www.domain.com/ or / will do.
Also, if your Web server can handle it, you might want to enable Clean URLs (which can be found on the above admin/settings path). This page explains Clean URLs: http://drupal.org/node/15365
Tips anybody?
Best Gina
Hopefully, that helps you out.
-- Jason Flatt http://www.oadae.net/ Father of Six: http://www.flattfamily.com/ (Joseph, 13; Cramer, 11; Travis, 9; Angela; Harry, 5; and William, 12:04 am, 12-29-2005) Linux User: http://www.sourcemage.org/ Drupal Fanatic: http://drupal.org/ -- [ Drupal support list | http://lists.drupal.org/ ]
On Monday 03 July 2006 10:50, Gina Rydland wrote:
Hi
You should only use the part after the ?q= when ever referencing a path. i.e.: if the path is: http://www.domain.com/?q=admin/settings use admin/settings
Answer: The problem is that there is nothing after ?q= on my front page, it is just the URL followed by /?q=
Gina
There isn't supposed to be anything after the ?q= on the front page.
These are the areas I find where I can change it to PHP. Am I at the right place?
Gina
edit block Block title:
The title of the block as shown to the user. Input format:
Filtered HTML a.. Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> b.. Lines and paragraphs break automatically. PHP code a.. Lines and paragraphs break automatically. b.. Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> Full HTML a.. Lines and paragraphs break automatically.
----------------------------------------------------------------
input formats Input formats define a way of processing user-supplied text in Drupal. Every input format has its own settings of which filters to apply. Possible filters include stripping out malicious HTML and making URLs clickable.
Users can choose between the available input formats when submitting content.
Below you can configure which input formats are available to which roles, as well as choose a default input format (used for imported content, for example).
--------------------------------------------------------------------------------
Permissions and settings Name Default anonymous user authenticated user Operations
configure
configure delete
configure delete
----- Original Message ----- From: "Jason Flatt" drupal@oadae.net To: support@drupal.org Sent: Monday, July 03, 2006 7:19 PM Subject: Re: [support] Path does not work
You appear to be asking several different questions, but I'm also not entirely sure I understand your English. I will attempt to answer as best as I can.
On Sunday 02 July 2006 11:57, Gina Rydland wrote:
Hi
I have tried using php script as described on the drupal site to make new blocks I make to only show up after the user has logged in.
On your block configuration page in the "Page specific visibility settings" area, select the PHP option (the third one) and try something like the following:
<?php global $user; if ($user->uid) { return TRUE; } else { return FALSE; } ?>
That will show the block with the content you specified in the "Block body" area on every page only after the user has logged in. If you also want to exclude the admin account, change "if ($user->uid) {" to "if ($user->uid > 1) {".
Also, if you want brevity, the following will work:
<?php global $user; return $user->uid; ?>
I have tried to use path to make blocks not appear or appear only on the front side before people have logged in.
Using the above example, you would place the code in the "Block body" instead, but change it like so:
<?php global $user; if (!$user->uid) { --PUT YOUR BLOCK CONTENT HERE AS PHP CODE-- } ?>
Make sure your "Input format" is set to "PHP Code". Next, in the "Page specific visibility settings" area, select the "Show on only the listed pages." option and put the following in the textarea:
<front>
That will show the block ONLY on the front page, and only if the user is NOT logged in.
All of this is outlined in the "Controlling block visibility with PHP" handbook page: http://drupal.org/node/64135
Non of it works.
I have my alias url enabled, I have php enabled, nothing works.
I also have a problem with the front page that shows up with the URL followed by this: /?q= The path configuration will not accept this as a path, yet this is the only "path" showing up at the front before you have logged in and at the first page (home page) after you have logged in.
You should only use the part after the ?q= when ever referencing a path. i.e.: if the path is: http://www.domain.com/?q=admin/settings use admin/settings
For situations where you are referencing the front page, then either http://www.domain.com/ or / will do.
Also, if your Web server can handle it, you might want to enable Clean URLs (which can be found on the above admin/settings path). This page explains Clean URLs: http://drupal.org/node/15365
Tips anybody?
Best Gina
Hopefully, that helps you out.
-- Jason Flatt http://www.oadae.net/ Father of Six: http://www.flattfamily.com/ (Joseph, 13; Cramer, 11; Travis, 9; Angela; Harry, 5; and William, 12:04 am, 12-29-2005) Linux User: http://www.sourcemage.org/ Drupal Fanatic: http://drupal.org/ -- [ Drupal support list | http://lists.drupal.org/ ]
Hmm, it looks as though you might be using Drupal version 4.6. Are you?
On Monday 03 July 2006 10:59, Gina Rydland wrote:
These are the areas I find where I can change it to PHP. Am I at the right place?
Gina
edit block Block title:
The title of the block as shown to the user. Input format:
[ s n i p ]
On 7/2/06, dondi_2006 dondi_2006@libero.it wrote:
Hello,
Some days ago I had asked on this list how to add content in Drupal from the mysql command line. I only got one suggestion to try the import_HTML module (http://drupal.org/node/46008) but it really seems an overkill, and not the best approach to what I have to do.
I had also asked how to do the same thing in two different ways in the forums: http://drupal.org/node/62954 http://drupal.org/node/68605
without result so far: no feedback from others who posted, who I contacted directly, no usable documentation I could recognize, nothing...
Honestly, I can't believe this has never been done before: What I need to do is something that (OUTSIDE Drupal) reads a .txt file like this:
ARTICLE_CATEGORIES="travel/england/london, food/foreign/restaurants" TEXT="path/to/some/local/html/file/" CREATED_ON_DATE="YYYY/MM/DD" AUTHOR="John Doe"
etc etc.... (other variables like, for example, "create_a_forum_for_this_node")
and upload the node inside the Drupal database, just if I had inserted everything by hand in the proper drupal form.
I don't want to do it via drupal because I need this to happen regularly and automatically (say, a cron job on my home PC which publishes via ssh whatever file in $DRUPAL_CONTENT folder changed in the last hour): it's not a one-time job.
I've also tried to look for scripts doing this via the blogger API (or usable documentation on how to write them so they _are_ drupal compatible): nothing.
What am I missing? Is it really possible that everybody is happy pasting and changing stuff manually in a tiny textarea, EVERY darned time some node must be added or updated??
Thanks,
O.
-- [ Drupal support list | http://lists.drupal.org/ ]
Have a look at the mailhandler.module, which allows creation of content from email. This is probably the closest thing to what you're after, and could probably be modified to create content from the filesystem.
On Jul 2, 2006, at 11:45 AM, dondi_2006 wrote:
What am I missing? Is it really possible that everybody is happy pasting and changing stuff manually in a tiny textarea, EVERY darned time some node must be added or updated??
Btw, in a site I'm building, I will need to maintain (add/update) a set of nodes based on data from an external source. I have not yet decided on an approach. I'd love to hear how you end up solving your case.
Ray
Have a look at sympal_scripts http://cvs.drupal.org/viewcvs/drupal/contributions/tricks/sympal_scripts/
It contains an easy way to include Drupal on commandline.
Some form of insert content script is on my todolist, but not done yet.
in any case, including Drupal with sympal scripts is not hard, and after that you can simply say: node_save($node) to save your node object.
Anything else *will* break, talking directly to the database is a very bad idea, since a lot of modules have data that is inserted when they are called by node_save()
Bèr
Op zondag 2 juli 2006 17:45, schreef dondi_2006:
Hello,
Some days ago I had asked on this list how to add content in Drupal from the mysql command line. I only got one suggestion to try the import_HTML module (http://drupal.org/node/46008) but it really seems an overkill, and not the best approach to what I have to do.
I had also asked how to do the same thing in two different ways in the forums: http://drupal.org/node/62954 http://drupal.org/node/68605
without result so far: no feedback from others who posted, who I contacted directly, no usable documentation I could recognize, nothing...
Honestly, I can't believe this has never been done before: What I need to do is something that (OUTSIDE Drupal) reads a .txt file like this:
ARTICLE_CATEGORIES="travel/england/london, food/foreign/restaurants" TEXT="path/to/some/local/html/file/" CREATED_ON_DATE="YYYY/MM/DD" AUTHOR="John Doe"
etc etc.... (other variables like, for example, "create_a_forum_for_this_node")
and upload the node inside the Drupal database, just if I had inserted everything by hand in the proper drupal form.
I don't want to do it via drupal because I need this to happen regularly and automatically (say, a cron job on my home PC which publishes via ssh whatever file in $DRUPAL_CONTENT folder changed in the last hour): it's not a one-time job.
I've also tried to look for scripts doing this via the blogger API (or usable documentation on how to write them so they _are_ drupal compatible): nothing.
What am I missing? Is it really possible that everybody is happy pasting and changing stuff manually in a tiny textarea, EVERY darned time some node must be added or updated??
Thanks,
O.
I think something like Bèr is suggesting is probably the best way to go.
I suppose another approach is to write a script that talks directly to the web interface (a reasonable option if you are Perl programmer trying to avoid learning PHP, for example :-). I did such things a number of years ago for testing a web app. I had some Perl code that made HTTP requests to the server and parsed the relevant parts of the responses. Nowadays, I'm sure there are tools that will handle much of the dirty work for you. Sure, it'll be slower than writing directly to the database (which I agree is a bad idea, btw) or using some command-line Drupal code like Bèr suggests, but it should be relatively safe and it does satisfy the goal of automating the process.
Ray
On Jul 4, 2006, at 10:06 AM, Bèr Kessels wrote:
Have a look at sympal_scripts http://cvs.drupal.org/viewcvs/drupal/contributions/tricks/ sympal_scripts/
It contains an easy way to include Drupal on commandline.
Some form of insert content script is on my todolist, but not done yet.
in any case, including Drupal with sympal scripts is not hard, and after that you can simply say: node_save($node) to save your node object.
Anything else *will* break, talking directly to the database is a very bad idea, since a lot of modules have data that is inserted when they are called by node_save()
Bèr
Op zondag 2 juli 2006 17:45, schreef dondi_2006:
Hello,
Some days ago I had asked on this list how to add content in Drupal from the mysql command line. I only got one suggestion to try the import_HTML module (http://drupal.org/node/46008) but it really seems an overkill, and not the best approach to what I have to do.
I had also asked how to do the same thing in two different ways in the forums: http://drupal.org/node/62954 http://drupal.org/node/68605
without result so far: no feedback from others who posted, who I contacted directly, no usable documentation I could recognize, nothing...
Honestly, I can't believe this has never been done before: What I need to do is something that (OUTSIDE Drupal) reads a .txt file like this:
ARTICLE_CATEGORIES="travel/england/london, food/foreign/restaurants" TEXT="path/to/some/local/html/file/" CREATED_ON_DATE="YYYY/MM/DD" AUTHOR="John Doe"
etc etc.... (other variables like, for example, "create_a_forum_for_this_node")
and upload the node inside the Drupal database, just if I had inserted everything by hand in the proper drupal form.
I don't want to do it via drupal because I need this to happen regularly and automatically (say, a cron job on my home PC which publishes via ssh whatever file in $DRUPAL_CONTENT folder changed in the last hour): it's not a one-time job.
I've also tried to look for scripts doing this via the blogger API (or usable documentation on how to write them so they _are_ drupal compatible): nothing.
What am I missing? Is it really possible that everybody is happy pasting and changing stuff manually in a tiny textarea, EVERY darned time some node must be added or updated??
Thanks,
O.
-- [ Drupal support list | http://lists.drupal.org/ ]
Op dinsdag 4 juli 2006 16:40, schreef Ray Zimmerman:
I suppose another approach is to write a script that talks directly to the web interface
The tool "curl" can be used for such things too. I helped develop a KDE curl script (very simple) that posts images to flickr. This is all there is to that:
curl -s -F photo=@%f -F email=mail@example.com -F password=s3cr37 -F title="%n" -F tags="`kdialog --inputbox Tag %n`" -F is_public=1 http://www.flickr.com/tools/uploader_go.gne > /dev/null
In this very case, flickr has made their web-interface 'script friendly' too, but I am certain one can develop something like this for Drupal too.
Bèr