Jump to content

virap1

Clients
  • Posts

    110
  • Joined

  • Last visited

 Content Type 

Downloads

Release Notes

IPS4 Guides

IPS4 Developer Documentation

Invision Community Blog

Development Blog

Deprecation Tracker

Providers Directory

Forums

Events

Store

Gallery

Everything posted by virap1

  1. I must be missing something because I can't upload a picture along with the database record. This code works as expected, but fails to add the picture to the featured image field. Any ideas what I am doing wrong? Thank you. $zimg="https://content.invisioncic.com/e322713/pages_media/3_1.jpg"; $image = array(); $image['article']=file_get_contents($zimg); $fields = array(); $fields['18']="title test"; $fields['19']="desc test"; $fields['image']=$image; $data = array( "title" => "title test1", "content" => "content test1", "status" => "published", // Or "draft" "category" => 19, "author" => 191972, "fields" => $fields, ); $communityUrl = 'https://www.communityUrl.com/'; $apiKey = 'apiKey'; $curl = curl_init( $communityUrl . 'api/cms/records/7' ); curl_setopt_array( $curl, array( CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_USERPWD => "{$apiKey}:", CURLOPT_USERAGENT => "MyUserAgent/1.0", CURLOPT_POST => 1, CURLOPT_POSTFIELDS => http_build_query($data), ) ); $response = curl_exec( $curl );
  2. Same issue, databases gone, entire section with thousands of articles down.
  3. @Nathan Explosion thank you very much. Your suggestion works as expected.
  4. Sound, thank you but I am not sure I understood. @Nathan Explosion Here is the full code where cat_id should be the current article (database record) category id {{if request.app == 'cms' }} {block="articles_related_articles_{$cat_id}"} {{endif}}
  5. That is intended to be used inside a custom html block that will display content based on the category id of a given database record.
  6. @Nathan Explosion thank you. Adding this {{$cat_id = $record->container()->id;}} results 503 error message in pages
  7. I have database articles with categories. I created a block that needs to be obtain the current category id for a given database record being displayed. I tried this and number of other things but still unable to get the category id. {{$cat_id=$category->database_id;}} Does anyone know how to do it? Thanks.
  8. @opentype thank you. You were correct, the syntax in the guide still works and I was implementing it in a wrong way. The problem I have now is that the ID variable is the topic id, how can I change it so I get the forum id instead. so the $id here {block="article_{$id}"} should be the forum id. {{if request.app == 'forums' && request.module == 'forums'}} {{$id = \IPS\Request::i()->id;}} {block="article_{$id}"} {{endif}}
  9. Yes, i as basically forced to pay to adopt opentype's solution because my paid invision plan or the upgraded creator pro include no normal presentation solutions at all.
  10. So, the update is out and unless I am missing something the article image still does not appear as a cover, but a small thumbnail is displayed above text.
  11. By showing separate code for certain forums I could set up a block for each forum which will pull the records from the corresponding databases and show them within forum topics. So the marriage plugin will display marriage database records in marriage forum etc.
  12. Is there a way to modify that guides code so it works with the current version of invision? Thanks.
  13. Thank you @opentype, @Marc Stridgen. So the method described here would not achieve this? This is an older guide and the code does not work, but appears to be describing exactly what I want to do.
  14. Thank you Randy. In my setup the forums are separate and not within the db.
  15. Randy, the forums are separate, not part of the database.
  16. I am trying to setup the website in a way that related content from database entries are shows in forums, topics and the other way around. So, let's say there is a forum called Marriage and then an articles database which has a category of Marriage. How I would display marriage articles within marriage topics? Thank you.
  17. I don't see anything on how to send the data for the Record Image? Just as image => image url ?
  18. I accidentally figured out that adding the content like this $fields['19']="description test" solves the issue. Thank you for pointing me to the right direction.
  19. Thank you @Daniel F. The problem is no matter how I try I can't get it to work. Setting it directly through title=> "test title" or through the $fields array does not work $fields['18']="title test"; $fields['title']="title z"; $fields['content']="content z"; $data = array( "title" => "title test1", "content" => "content test1", "status" => "published", // Or "draft" "category" => 19, "author" => 191972, "fields" => $fields, );
  20. Sorry to bump this. Could someone help me solve the TITLE_CONTENT_REQUIRED error and to understand how to properly send the title and content of the database entry? Thank you.
  21. Hello. I hope someone can help me to understand how to include a title while trying to submit a database entry using rest api. At the moment this code given an error message saying "errorMessage": "TITLE_CONTENT_REQUIRED" Thank you very much. $fields[18]="title test"; $data = array( "status" => "published", // Or "draft" "category" => 19, "author" => 191972, "fields" => $fields, ); $communityUrl = 'https://www.mydomain.com/'; $apiKey = 'my key'; $curl = curl_init( $communityUrl . 'api/cms/records/7' ); curl_setopt_array( $curl, array( CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_USERPWD => "{$apiKey}:", CURLOPT_USERAGENT => "MyUserAgent/1.0", CURLOPT_POST => 1, CURLOPT_POSTFIELDS => http_build_query($data), ) ); $response = curl_exec( $curl );
  22. So tried to see if I can use the Rest api to get the blog records and move them to the database, but I am getting "401 Unauthorized" error saying "errorCode": "3S290\/9", "errorMessage": "INVALID_ACCESS_TOKEN" Here is the base php code <?php // IPB REST API settings $api_url = 'https://your-forum-url.com/api/rest/'; $api_key = 'your-api-key'; // Set up the API request $request_url = $api_url . 'blog/posts?sortField=date&sortOrder=asc&limit=1'; $request_headers = [ 'Authorization: Bearer ' . $api_key, 'Content-Type: application/json', ]; // Send the API request $ch = curl_init($request_url); curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); // Check for errors if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } else { $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code !== 200) { echo 'Error: API returned HTTP code ' . $http_code; } else { // Parse the API response $posts = json_decode($response, true); // Display the oldest post data $oldest_post = $posts['results'][0]; echo '<h1>' . $oldest_post['title'] . '</h1>'; echo '<p>' . $oldest_post['content'] . '</p>'; } } // Clean up curl_close($ch);
  23. I see your post saying there is no such solution at all is marked as a solution. That is both funny and sad.
×
×
  • Create New...