MDN

Go Back   Mambo - Forums Closed for posting > Mambo 4.5.5 - Stable > Converting to Mambo

Reply
 
Thread Tools Search this Thread Display Modes
Old June 29th, 2006, 04:48   #1
cirano
 
Join Date: Jan 2005
Posts: 38
cirano is on a distinguished road
Default mos_content introtext and friends

Hi,

I have an existing mambo install and want to allow other people to post on my site. The thing is, I want to allow them to post only limited information (Subject, link to site and thumbnail), which I will wrap into some other code that makes it look more like my site. When I add news through mambo, I have to modify some html manually and I'd like to hide that part from my posters. Like a preaproved account if you like. Thus, i dont really need no mambo components, I just need to write some data to mos_content. I know how to make simple queryes, but not familiar with this of mambo database. Could someone tell me which fields are obligatory and give me an example of the simplest authorisation and queryes I need to do to add "abc" as title and "bcd" as introtext and show it on the frontpage automatically. From there I can extend "bcd" to code i want there.
__________________
In the compliance with the Signature Rules: http://forum.mamboserver.com/showthread.php?t=36375 I hope that http://www.pricelessfunnypictures.com is ok.
cirano is offline   Reply With Quote
Old July 2nd, 2006, 08:53   #2
cirano
 
Join Date: Jan 2005
Posts: 38
cirano is on a distinguished road
Default

Bump, anyone?
__________________
In the compliance with the Signature Rules: http://forum.mamboserver.com/showthread.php?t=36375 I hope that http://www.pricelessfunnypictures.com is ok.
cirano is offline   Reply With Quote
Old July 2nd, 2006, 12:08   #3
inagmamboAko
 
inagmamboAko's Avatar
 
Join Date: Jan 2006
Location: NY, USA
Posts: 1,289
inagmamboAko is on a distinguished road
Default

Hi!

I really tried to recreate what you wanted to happen but the info just does'nt make sense especially "the wrapping of code that looks like your site" but most can be done like: Add News | Post Articles . The rest are just...too much.


Last edited by inagmamboAko : July 3rd, 2006 at 15:51.
inagmamboAko is offline   Reply With Quote
Old July 2nd, 2006, 15:10   #4
cirano
 
Join Date: Jan 2005
Posts: 38
cirano is on a distinguished road
Default

Hey,

You can disregard everything else but the final part. Basically I want to enter "abc" as subject and "def" as body of a frontpage post. And I want it to be published as soon as it is posted. But I don't want to post it via mambo, I want it writen directly to it's database. The thing is, post wont say "def", it will be changed the way I need. I just dont want that extra code to be visible to my users, whic should be if they have to enter news via mambo. Please disregard everything but that simple task, entering title and body of post directly into mambo database. Should be easy, but I dont quite understand it's syle. I need basic query, I can go from there by myself.
__________________
In the compliance with the Signature Rules: http://forum.mamboserver.com/showthread.php?t=36375 I hope that http://www.pricelessfunnypictures.com is ok.
cirano is offline   Reply With Quote
Old July 3rd, 2006, 15:58   #5
inagmamboAko
 
inagmamboAko's Avatar
 
Join Date: Jan 2006
Location: NY, USA
Posts: 1,289
inagmamboAko is on a distinguished road
Default

Quote:
Originally Posted by cirano
Hey,

You can disregard everything else but the final part. Basically I want to enter "abc" as subject and "def" as body of a frontpage post. And I want it to be published as soon as it is posted. But I don't want to post it via mambo, I want it writen directly to it's database. The thing is, post wont say "def", it will be changed the way I need. I just dont want that extra code to be visible to my users, whic should be if they have to enter news via mambo. Please disregard everything but that simple task, entering title and body of post directly into mambo database. Should be easy, but I dont quite understand it's syle. I need basic query, I can go from there by myself.
Now eventhough I don't know the answer of your question but at least it is clear now what you really want to accomplish. And it is amazing how you able to think that far! I should say that's cool!

But hey! this is just my opinion. Take it or leave it!


inagmamboAko is offline   Reply With Quote
Old July 3rd, 2006, 20:36   #6
Arpee
 
Arpee's Avatar
 
Join Date: Feb 2006
Location: Philippines
Posts: 841
Arpee is on a distinguished road
Default

INSERT INTO `mos_content` (`id`,`title`,`title_alias`,`introtext`,`fulltext` ,`state`,`sectionid`,`mask`,`catid`,`created`,`cre ated_by`,`created_by_alias`,`modified`,`modified_b y`,`checked_out`,`checked_out_time`,`publish_up`,` publish_down`,`images`,`urls`,`attribs`,`version`, `parentid`,`ordering`,`metakey`,`metadesc`,`access `,`hits`) VALUES
(Values go here separated by commas (string should be enclosed in single quotes.)

Here are the datatype to guide you.

id = Integer ; keep this item blank if you intend to do an insert, mysql autoincrements this automatically, (if left blank, insert fails on some mysql clients stating an "out of range" error, so i suggest you come up with a script which determines the highest id value and add 1 to the new one, more like doing the auto_increment urself
title = varchar(100) ; title here

title_alias = varchar(100) ;title alias here
introtext = mediumtext ;ur intro text
fulltext = mediumtext ; ur fulltext
state = TINYINT(3) ;
sectionid = INTEGER ;the section id this content belongs
mask = INTEGER ;
catid = INTEGER ;
created = DATETIME
created_by = INTEGER
created_by_alias = VARCHAR(100)
modified = DATETIME
modified_by = INTEGER
checked_out = INTEGER
checked_out_time = DATETIME
publish_up = DATETIME
publish_down = DATETIME
images = TEXT
urls = TEXT
attribs = TEXT ; example values are.

ageclass_sfx=
back_button=1
item_title=1
link_titles=
introtext=1
section=0
section_link=0
category=0
category_link=0
rating=
author=0
createdate=0
modifydate=0
pdf=0
print=0
email=
keyref=
docbook_type=

version = INTEGER
parentid = INTEGER
ordering = INTEGER
metakey = TEXT
metadesc = TEXT
access = INTEGER
hits = INTEGER

what you are trying to do is possible. But you should take into consideration the sectionid and catid which determines where a content belong in the categories and sections notion. and most esp the ID which you should be certain that the new item to be added will be one value higher than the highest id. Are you sure you want to do this? I'll be writing a guide about "What happens to your MySQL database when u add content in Mambo", give me time though..

by the way, heres a sample script which add content to a section 1 and category 2, with an ID of 1 and is published on the frontpage:

Code:
INSERT INTO `mos_content` (`id`,`title`,`title_alias`,`introtext`,`fulltext`,`state`,`sectionid`,`mask`,`catid`,`created`,`created_by`,`created_by_alias`,`modified`,`modified_by`,`checked_out`,`checked_out_time`,`publish_up`,`publish_down`,`images`,`urls`,`attribs`,`version`,`parentid`,`ordering`,`metakey`,`metadesc`,`access`,`hits`) VALUES
(1,'Title','Title Alias','introtext{mosimage}','Maintext',1,1,2,29,'2006-07-04 11:11:47',62,'','0000-00-00 00:00:00',0,0,'0000-00-00 00:00:00','2006-07-04 00:00:00','0000-00-00 00:00:00','articles.jpg|||0||bottom||','','pageclass_sfx=\nback_button=\nitem_title=1\nlink_titles=\nintrotext=1\nsection=0\nsection_link=0\ncategory=0\ncategory_link=0\nrating=\nauthor=\ncreatedate=\nmodifydate=\npdf=\nprint=\nemail=',1,0,1,'Keywords','Description',0,0);
Goodluck anyways..
__________________
MiaCMS: http://miacms.org

Last edited by Arpee : July 3rd, 2006 at 20:56.
Arpee is offline   Reply With Quote
Old July 7th, 2006, 13:17   #7
cirano
 
Join Date: Jan 2005
Posts: 38
cirano is on a distinguished road
Default

Thanks a lot, that (almost) works! I used your code to construct my queryes and it worked like a charm. After I submit posts they are correctly written into database but for some reason they're not published on the frontpage. Maybe it has something to do with dates?
__________________
In the compliance with the Signature Rules: http://forum.mamboserver.com/showthread.php?t=36375 I hope that http://www.pricelessfunnypictures.com is ok.
cirano is offline   Reply With Quote
Old July 8th, 2006, 04:23   #8
Arpee
 
Arpee's Avatar
 
Join Date: Feb 2006
Location: Philippines
Posts: 841
Arpee is on a distinguished road
Default

Play around with the 'state' value, try -2, 1 or 2. Which is which, for you to discover.. , are u writing ur own PHP+mYSQL scripts to admin mambo? PM me ur email.. good day..
__________________
MiaCMS: http://miacms.org
Arpee is offline   Reply With Quote
Old July 8th, 2006, 13:18   #9
cirano
 
Join Date: Jan 2005
Posts: 38
cirano is on a distinguished road
Default

Tried that but nothing happened News don't show up on the frontpage but I see them in my admin panel. They are published but that "Front Page" button has red x.
It looks like there might be something outside mos_content that needs to be changed?
__________________
In the compliance with the Signature Rules: http://forum.mamboserver.com/showthread.php?t=36375 I hope that http://www.pricelessfunnypictures.com is ok.
cirano is offline   Reply With Quote
Old July 9th, 2006, 02:58   #10
Arpee
 
Arpee's Avatar
 
Join Date: Feb 2006
Location: Philippines
Posts: 841
Arpee is on a distinguished road
Default

Ooops! sorry, yes..

INSERT INTO `mos_content_frontpage` (`content_id`,`ordering`) VALUES
(1,1);

Where the 1st value is equal to the 'id' of the content you intend to publish.., the second one is the ordering..
so sorry, must be outta my mind..
__________________
MiaCMS: http://miacms.org
Arpee is offline   Reply With Quote
Old July 9th, 2006, 04:35   #11
cirano
 
Join Date: Jan 2005
Posts: 38
cirano is on a distinguished road
Default

Yeah, this seams to be the missing part tnx. However, problems not solved yet. If I got things right, "ordering" says which my post will be, in regards to previous ones. So the one that used to be first i.e. had order=1 should now have order=2, and the same for the rest of the posts. All should be pushed one place down. It looks like I have to first add 1 to every "ordering" and then to add my own post. Damn, this thing gets complicated more andmore, but I'll solve it with your help. Tnx Arpee!
__________________
In the compliance with the Signature Rules: http://forum.mamboserver.com/showthread.php?t=36375 I hope that http://www.pricelessfunnypictures.com is ok.
cirano is offline   Reply With Quote
Old July 9th, 2006, 05:19   #12
cirano
 
Join Date: Jan 2005
Posts: 38
cirano is on a distinguished road
Default

OK, and the final touch. Below is code needed to allow last post entered in "mos_content" to be automatically visible on your frontpage. Tnx everyone who contributed! Cirano

Code:
//get last ID inserted, use it just after that first Arpee's insertion mysql query from above!
$insert_id = mysql_insert_id();

//add 1 to every "ordering" index
mysql_query("UPDATE `mos_content_frontpage` SET ordering = ordering + 1");

//allow post with last inserted ID to be the very first post published on the front page
 mysql_query(" INSERT INTO `mos_content_frontpage`  (`content_id`,`ordering`) VALUES   ('$insert_id',1)");
__________________
In the compliance with the Signature Rules: http://forum.mamboserver.com/showthread.php?t=36375 I hope that http://www.pricelessfunnypictures.com is ok.
cirano is offline   Reply With Quote
Old July 9th, 2006, 22:48   #13
Arpee
 
Arpee's Avatar
 
Join Date: Feb 2006
Location: Philippines
Posts: 841
Arpee is on a distinguished road
Default

Yeap, the autoincrement,autodecrement functions..
bugged me once a few months, back, i was pushed to store values on a table named max_val to monitor current values: http://forum.mamboserver.com/showpos...5&postcount=26
the case is just the same wherein you need to know the value of the current one, update that value, and insert this new one with the value of the old one.. (what did i say?) well i know u understand, just sounds vague..

This ones great man! are u trying to write ur own mambo admin?
__________________
MiaCMS: http://miacms.org
Arpee is offline   Reply With Quote
Old July 11th, 2006, 16:24   #14
cirano
 
Join Date: Jan 2005
Posts: 38
cirano is on a distinguished road
Default

Sorry, but I lost you with this last description

As I said in my first post, I wanted to make preaproved accounts for people to post their image/video galleries. Kinda NSFW site so I won't give the url here. As I can see my modification so far works like a charm (and I learned a lot about mysql/php). I actually use a second database to check referrers and then script decides if they're allowed to post. When they post, they give me short title, upload thumb and link to their galleries. Then script modifies it in a such a way to better suite my mambo site (basically adding some ads and tables). The code I used is above, if anyone want's more info, feel free to ask me.
__________________
In the compliance with the Signature Rules: http://forum.mamboserver.com/showthread.php?t=36375 I hope that http://www.pricelessfunnypictures.com is ok.
cirano is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT -7. The time now is 08:55.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.